Skip to content

Commit

Permalink
Merge pull request #4950 from stuartwdouglas/failed-restart-config
Browse files Browse the repository at this point in the history
After failed start make sure to read the HTTP config with the correct TCCL
  • Loading branch information
stuartwdouglas authored Oct 29, 2019
2 parents f90efa8 + 30ec90b commit 7312a80
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions core/devmode/src/main/java/io/quarkus/dev/DevModeMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ public void start() throws Exception {
if (context.isAbortOnFailedStart()) {
throw new RuntimeException(deploymentProblem == null ? compileProblem : deploymentProblem);
}
log.error("Failed to start Quarkus, attempting to start hot replacement endpoint to recover");
if (runtimeUpdatesProcessor != null) {
runtimeUpdatesProcessor.startupFailed();
}
}
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
Expand Down Expand Up @@ -180,6 +176,20 @@ public void execute(BuildContext context) {
runner.run();
DevModeMain.runner = runner;
deploymentProblem = null;

} catch (Throwable t) {
deploymentProblem = t;
if (context.isAbortOnFailedStart() || liveReload) {
log.error("Failed to start quarkus", t);
} else {
//we need to set this here, while we still have the correct TCCL
//this is so the config is still valid, and we can read HTTP config from application.properties
log.error("Failed to start Quarkus, attempting to start hot replacement endpoint to recover");
if (runtimeUpdatesProcessor != null) {
runtimeUpdatesProcessor.startupFailed();
}
}

} finally {
Thread.currentThread().setContextClassLoader(old);
}
Expand Down

0 comments on commit 7312a80

Please sign in to comment.