From f3013d0764202dfb936231eceecc64f40540e0c3 Mon Sep 17 00:00:00 2001 From: Matt Gilman Date: Wed, 7 Feb 2018 13:52:02 -0500 Subject: [PATCH] NIFI-4837: - When Jetty initializes fails, performing a shutdown sequence to ensure all allocated resources are released. This closes #2455. Signed-off-by: Bryan Bende --- .../nifi/processors/standard/HandleHttpRequest.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java index 5f17156c54..d436312430 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java @@ -485,7 +485,15 @@ public class HandleHttpRequest extends AbstractProcessor { } } catch (Exception e) { context.yield(); - throw new ProcessException("Failed to initialize the server",e); + + try { + // shutdown to release any resources allocated during the failed initialization + shutdown(); + } catch (final Exception shutdownException) { + getLogger().debug("Failed to shutdown following a failed initialization: " + shutdownException); + } + + throw new ProcessException("Failed to initialize the server", e); } HttpRequestContainer container;