Lehel44 commented on a change in pull request #5195:
URL: https://github.com/apache/nifi/pull/5195#discussion_r689915873



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-runtime/src/main/java/org/apache/nifi/NiFi.java
##########
@@ -201,40 +206,70 @@ protected void initLogging() {
     private static ClassLoader createBootstrapClassLoader() {
         //Get list of files in bootstrap folder
         final List<URL> urls = new ArrayList<>();
-        try {
-            Files.list(Paths.get("lib/bootstrap")).forEach(p -> {
+        try (final Stream<Path> files = 
Files.list(Paths.get("lib/bootstrap"))) {
+            files.forEach(p -> {
                 try {
                     urls.add(p.toUri().toURL());
                 } catch (final MalformedURLException mef) {
-                    LOGGER.warn("Unable to load " + p.getFileName() + " due to 
" + mef, mef);
+                    logger.warn("Unable to load " + p.getFileName() + " due to 
" + mef, mef);
                 }
             });
         } catch (IOException ioe) {
-            LOGGER.warn("Unable to access lib/bootstrap to create bootstrap 
classloader", ioe);
+            logger.warn("Unable to access lib/bootstrap to create bootstrap 
classloader", ioe);
         }
         //Create the bootstrap classloader
         return new URLClassLoader(urls.toArray(new URL[0]), 
Thread.currentThread().getContextClassLoader());
     }
 
-    public void shutdownHook(boolean isReload) {
+    public void shutdownHook(final boolean isReload) {
         try {
+            runAutomaticDiagnostics();
             shutdown();
         } catch (final Throwable t) {
-            LOGGER.warn("Problem occurred ensuring Jetty web server was 
properly terminated due to " + t);
+            logger.warn("Problem occurred ensuring Jetty web server was 
properly terminated due to ", t);
         }
     }
 
+    private void runAutomaticDiagnostics() throws IOException {

Review comment:
       I renamed it to runDiagnosticsOnShutdown align with the property names 
(diagnostics on shutdown).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to