Continue shutdown if an exception is thrown.

This commit is contained in:
akwizgran
2022-06-09 17:16:02 +01:00
parent efb1b8c1ad
commit 85d1addd04

View File

@@ -198,11 +198,15 @@ class LifecycleManagerImpl implements LifecycleManager, MigrationListener {
state = STOPPING;
eventBus.broadcast(new LifecycleEvent(STOPPING));
for (Service s : services) {
long start = now();
s.stopService();
if (LOG.isLoggable(FINE)) {
logDuration(LOG, "Stopping service "
+ s.getClass().getSimpleName(), start);
try {
long start = now();
s.stopService();
if (LOG.isLoggable(FINE)) {
logDuration(LOG, "Stopping service "
+ s.getClass().getSimpleName(), start);
}
} catch (ServiceException e) {
logException(LOG, WARNING, e);
}
}
for (ExecutorService e : executors) {
@@ -212,12 +216,14 @@ class LifecycleManagerImpl implements LifecycleManager, MigrationListener {
}
e.shutdownNow();
}
long start = now();
db.close();
logDuration(LOG, "Closing database", start);
try {
long start = now();
db.close();
logDuration(LOG, "Closing database", start);
} catch (DbException e) {
logException(LOG, WARNING, e);
}
shutdownLatch.countDown();
} catch (DbException | ServiceException e) {
logException(LOG, WARNING, e);
} finally {
startStopSemaphore.release();
}