From 535fadab4830de0634617eb66698fc9204987b69 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. --- .../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 5f17156c54ff..d43631243099 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 void onTrigger(final ProcessContext context, final ProcessSession session } } 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;