Skip to content

Commit

Permalink
Clean up CurrentConfig on shutdown
Browse files Browse the repository at this point in the history
To avoid ClassLoader leaks.
  • Loading branch information
yrodiere authored and gsmet committed Aug 18, 2023
1 parent 14739af commit bbaa305
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.ConfigDescriptionBuildItem;
import io.quarkus.deployment.builditem.CuratedApplicationShutdownBuildItem;
import io.quarkus.deployment.builditem.DevServicesLauncherConfigResultBuildItem;
import io.quarkus.dev.config.CurrentConfig;
import io.quarkus.dev.console.DevConsoleManager;
Expand Down Expand Up @@ -95,7 +96,8 @@ void registerConfigs(List<ConfigDescriptionBuildItem> configDescriptionBuildItem
void registerJsonRpcService(
BuildProducer<JsonRPCProvidersBuildItem> jsonRPCProvidersProducer,
BuildProducer<SyntheticBeanBuildItem> syntheticBeanProducer,
ConfigDevUIRecorder recorder) {
ConfigDevUIRecorder recorder,
CuratedApplicationShutdownBuildItem shutdown) {

DevConsoleManager.register("config-update-property", map -> {
Map<String, String> values = Collections.singletonMap(map.get("name"), map.get("value"));
Expand All @@ -116,6 +118,13 @@ void registerJsonRpcService(
.done());

CurrentConfig.EDITOR = ConfigurationProcessor::updateConfig;
shutdown.addCloseTask(new Runnable() {
@Override
public void run() {
CurrentConfig.EDITOR = null;
CurrentConfig.CURRENT = Collections.emptyList();
}
}, true);

jsonRPCProvidersProducer.produce(new JsonRPCProvidersBuildItem("devui-configuration", ConfigJsonRPCService.class));
}
Expand Down

0 comments on commit bbaa305

Please sign in to comment.