Skip to content
Permalink
Browse files
Improved: Inline ‘StartupControlPanel#createLogDirectoryIfMissing’.
Use a lambda instead of an anonymous class to implement a thread.
  • Loading branch information
mthl committed Dec 7, 2019
1 parent df5dde3 commit d4c59c3bde56eb3119729ec8f5eae74ef883dbff
Showing with 1 addition and 10 deletions.
  1. +1 −10 framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java
@@ -63,7 +63,7 @@ static void start(Config config, AtomicReference<ServerState> serverState, List<
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 @@ private static void createLogDirectoryIfMissing(String logDirName) {
}
}

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,

0 comments on commit d4c59c3

Please sign in to comment.