Keep startup errors
This commit is contained in:
@@ -25,6 +25,7 @@ public class DevStackApplication {
|
|||||||
CountDownLatch shutdownLatch = new CountDownLatch(1);
|
CountDownLatch shutdownLatch = new CountDownLatch(1);
|
||||||
ScheduledExecutorService scheduler = null;
|
ScheduledExecutorService scheduler = null;
|
||||||
AtomicBoolean shuttingDown = new AtomicBoolean(false);
|
AtomicBoolean shuttingDown = new AtomicBoolean(false);
|
||||||
|
RuntimeException startupFailure = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
validateJavaVersion();
|
validateJavaVersion();
|
||||||
@@ -42,6 +43,7 @@ public class DevStackApplication {
|
|||||||
scheduler = startDatabaseWatch(docker, context, shuttingDown);
|
scheduler = startDatabaseWatch(docker, context, shuttingDown);
|
||||||
shutdownLatch.await();
|
shutdownLatch.await();
|
||||||
} catch (RuntimeException ex) {
|
} catch (RuntimeException ex) {
|
||||||
|
startupFailure = ex;
|
||||||
throw new IllegalStateException(describeStartupFailure(ex), ex);
|
throw new IllegalStateException(describeStartupFailure(ex), ex);
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
@@ -54,7 +56,15 @@ public class DevStackApplication {
|
|||||||
context.close();
|
context.close();
|
||||||
}
|
}
|
||||||
if (!shuttingDown.get()) {
|
if (!shuttingDown.get()) {
|
||||||
docker.stopDatabase();
|
try {
|
||||||
|
docker.stopDatabase();
|
||||||
|
} catch (RuntimeException stopFailure) {
|
||||||
|
if (startupFailure != null) {
|
||||||
|
System.err.println(stopFailure.getMessage());
|
||||||
|
} else {
|
||||||
|
throw stopFailure;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user