[ofbiz-framework] branch trunk updated: Improved: Inline ‘StartupControlPanel#createLogDirectoryIfMissing’.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Improved: Inline ‘StartupControlPanel#createLogDirectoryIfMissing’.

mthl
This is an automated email from the ASF dual-hosted git repository.

mthl pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new d4c59c3  Improved: Inline ‘StartupControlPanel#createLogDirectoryIfMissing’.
d4c59c3 is described below

commit d4c59c3bde56eb3119729ec8f5eae74ef883dbff
Author: Mathieu Lirzin <[hidden email]>
AuthorDate: Sun Dec 8 00:31:26 2019 +0100

    Improved: Inline ‘StartupControlPanel#createLogDirectoryIfMissing’.
   
    Use a lambda instead of an anonymous class to implement a thread.
---
 .../java/org/apache/ofbiz/base/start/StartupControlPanel.java | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java b/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java
index f6c4fd6..9e089e7 100644
--- a/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java
+++ b/framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java
@@ -63,7 +63,7 @@ final class StartupControlPanel {
         createLogDirectoryIfMissing(config.logDir.toString());
 
         if (config.useShutdownHook) {
-            createRuntimeShutdownHook(loader, serverState);
+            Runtime.getRuntime().addShutdownHook(new Thread(() -> shutdownServer(loader, serverState)));
         } else {
             System.out.println("Shutdown hook disabled");
         }
@@ -140,15 +140,6 @@ final class StartupControlPanel {
         }
     }
 
-    private static void createRuntimeShutdownHook(ContainerLoader loader, AtomicReference<ServerState> serverState) {
-        Runtime.getRuntime().addShutdownHook(new Thread() {
-            @Override
-            public void run() {
-                shutdownServer(loader, serverState);
-            }
-        });
-    }
-
     private static void loadContainers(Config config,
             ContainerLoader loader,
             List<StartupCommand> ofbizCommands,