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