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 committed Aug 17, 2023
1 parent c10432b commit 315e787
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import io.quarkus.deployment.builditem.CuratedApplicationShutdownBuildItem;
import jakarta.inject.Singleton;

import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
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 315e787

Please sign in to comment.