diff --git a/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java b/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java index af783a1bc1..1b82a3c684 100644 --- a/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java +++ b/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java @@ -397,7 +397,11 @@ public class RunNiFi { } catch (final InterruptedException ie) { } } else { - runtime.removeShutdownHook(shutdownHook); + try { + runtime.removeShutdownHook(shutdownHook); + } catch (final IllegalStateException ise) { + // happens when already shutting down + } if (autoRestartNiFi) { System.out.println("Apache NiFi appears to have died. Restarting...");