Skip to content

Commit

Permalink
Fixes #3409
Browse files Browse the repository at this point in the history
The old config provider resolver was not being restored
on shutdown, which would cause problems on restarts.
  • Loading branch information
stuartwdouglas authored and gsmet committed Sep 4, 2019
1 parent 2c9a9a8 commit 79c2dba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/devmode/src/main/java/io/quarkus/dev/DevModeMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,12 @@ public void stop() {
}

public void close() {
stop();
for (HotReplacementSetup i : hotReplacement) {
i.close();
try {
stop();
} finally {
for (HotReplacementSetup i : hotReplacement) {
i.close();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.LockSupport;

import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
import org.graalvm.nativeimage.ImageInfo;
import org.wildfly.common.Assert;
import org.wildfly.common.lock.Locks;
Expand Down Expand Up @@ -37,6 +38,12 @@ public abstract class Application {
private volatile boolean shutdownRequested;
private static volatile Application currentApplication;

/**
* The generated config code will install a new resolver, we save the original one here and make sure
* to restore it on shutdown.
*/
private final static ConfigProviderResolver originalResolver = ConfigProviderResolver.instance();

/**
* Construct a new instance.
*/
Expand Down Expand Up @@ -151,6 +158,7 @@ public final void stop() {
doStop();
} finally {
currentApplication = null;
ConfigProviderResolver.setInstance(originalResolver);
stateLock.lock();
try {
state = ST_STOPPED;
Expand Down

0 comments on commit 79c2dba

Please sign in to comment.