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 <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/9a59d9b8 Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/9a59d9b8 Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/9a59d9b8 Branch: refs/heads/HDF-3.1-maint Commit: 9a59d9b8fcd8a8f8574be348491f7c3813965ba6 Parents: 63098ba Author: Matt Gilman <[email protected]> Authored: Wed Feb 7 13:52:02 2018 -0500 Committer: Matt Gilman <[email protected]> Committed: Wed Feb 7 20:22:15 2018 -0500 ---------------------------------------------------------------------- .../nifi/processors/standard/HandleHttpRequest.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/9a59d9b8/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpRequest.java ---------------------------------------------------------------------- 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 5f17156..d436312 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;
