Skip to content

Commit

Permalink
Improved: Inline ‘StartupControlPanel#createLogDirectoryIfMissing’.
Browse files Browse the repository at this point in the history
Use a lambda instead of an anonymous class to implement a thread.
  • Loading branch information
mthl committed Dec 7, 2019
1 parent df5dde3 commit d4c59c3
Showing 1 changed file with 1 addition and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d4c59c3

Please sign in to comment.