Skip to content

Commit

Permalink
Addresses PR feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Laird Nelson <[email protected]>
  • Loading branch information
ljnelson committed Jan 24, 2025
1 parent 25b0684 commit 15f229d
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class LoomServer implements WebServer {
private static final AtomicInteger WEBSERVER_COUNTER = new AtomicInteger(1);

private final Map<String, ServerListener> listeners;
private final Runnable afterStartNotifier;
private final AtomicBoolean running = new AtomicBoolean();
private final Lock lifecycleLock = new ReentrantLock();
private final ExecutorService executorService;
Expand Down Expand Up @@ -102,7 +101,6 @@ class LoomServer implements WebServer {
});

listeners = Map.copyOf(listenerMap);
afterStartNotifier = () -> listeners.values().forEach(l -> l.router().afterStart(this));
}

@Override
Expand Down Expand Up @@ -227,7 +225,7 @@ private void startIt() {
+ uptime + " milliseconds since JVM startup. "
+ "Java " + Runtime.version());

afterStartNotifier.run();
fireAfterStart();

if ("!".equals(System.getProperty(EXIT_ON_STARTED_KEY))) {
LOGGER.log(System.Logger.Level.INFO, String.format("Exiting, -D%s set.", EXIT_ON_STARTED_KEY));
Expand All @@ -243,6 +241,10 @@ private void startIt() {
}
}

private void fireAfterStart() {
listeners.values().forEach(l -> l.router().afterStart(this));
}

private void registerShutdownHook() {
this.shutdownHandler = new ServerShutdownHandler(listeners, startFutures, running, context.id());
Main.addShutdownHandler(this.shutdownHandler);
Expand Down

0 comments on commit 15f229d

Please sign in to comment.