Merge pull request #7335 from dmlloyd/revert-fj-config

Partially revert "Fix issue getting config from fork join pool"
This commit is contained in:
George Gastaldi
2020-02-21 15:57:06 -03:00
committed by GitHub
2 changed files with 2 additions and 10 deletions

View File

@@ -728,6 +728,8 @@ public final class RunTimeConfigurationGenerator {
}
private void installConfiguration(ResultHandle config, MethodCreator methodCreator) {
// install config
methodCreator.invokeStaticMethod(QCF_SET_CONFIG, config);
// now invalidate the cached config, so the next one to load the config gets the new one
final ResultHandle configProviderResolver = methodCreator.invokeStaticMethod(CPR_INSTANCE);
try (TryBlock getConfigTry = methodCreator.tryBlock()) {
@@ -737,8 +739,6 @@ public final class RunTimeConfigurationGenerator {
// ignore
getConfigTry.addCatch(IllegalStateException.class);
}
// install config
methodCreator.invokeStaticMethod(QCF_SET_CONFIG, config);
}
private void generateDefaultValuesConfigSourceClass(ConfigPatternMap<Container> patternMap, String className) {

View File

@@ -36,17 +36,9 @@ public final class QuarkusConfigFactory extends SmallRyeConfigFactory {
}
public static void setConfig(SmallRyeConfig config) {
//This is a hack, but there is not a great deal that can be done about it
//it is possible that when running in test/dev mode some code will be run with the system TCCL
//e.g. when using the fork join pool
//if this happens any use of config will fail, as the system class loader will resolve the
//wrong instance of the config classes
if (QuarkusConfigFactory.config != null) {
ConfigProviderResolver.instance().releaseConfig(QuarkusConfigFactory.config);
}
if (config != null) {
ConfigProviderResolver.instance().registerConfig(config, ClassLoader.getSystemClassLoader());
}
QuarkusConfigFactory.config = config;
}
}