Avoid errors during startup/shutdown

This commit is contained in:
Andrea Cavalli 2021-11-09 15:59:59 +01:00
parent 6439a1b486
commit 5bbe67f68f

View File

@ -50,7 +50,11 @@ public final class InternalReactiveClient implements ClientEventsHandler, Reacti
this.clientManager = clientManager;
this.updateHandler = new Handler<>(this::onUpdateFromHandler, this::onUpdateException);
this.defaultExceptionHandler = this::onDefaultException;
Runtime.getRuntime().addShutdownHook(shutdownHook);
try {
Runtime.getRuntime().addShutdownHook(shutdownHook);
} catch (IllegalStateException ex) {
this.onJVMShutdown();
}
}
@Override