From 315e787ed751d760328066087d948da3604747ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Thu, 17 Aug 2023 18:01:47 +0200 Subject: [PATCH] Clean up CurrentConfig on shutdown To avoid ClassLoader leaks. --- .../devui/deployment/menu/ConfigurationProcessor.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/ConfigurationProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/ConfigurationProcessor.java index 6818ff8fb5c38a..78f4f726426ac0 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/ConfigurationProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/ConfigurationProcessor.java @@ -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; @@ -95,7 +96,8 @@ void registerConfigs(List configDescriptionBuildItem void registerJsonRpcService( BuildProducer jsonRPCProvidersProducer, BuildProducer syntheticBeanProducer, - ConfigDevUIRecorder recorder) { + ConfigDevUIRecorder recorder, + CuratedApplicationShutdownBuildItem shutdown) { DevConsoleManager.register("config-update-property", map -> { Map values = Collections.singletonMap(map.get("name"), map.get("value")); @@ -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)); }