From bbaa3050583223e474cbb4eac80a4dfd1334e5d5 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 6818ff8fb5c38..2f2842e10d1b4 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 @@ -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; @@ -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)); }