From 8f9947b4366f645ebcc4147d542c27a3f10e3b45 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 19 Oct 2022 16:24:33 +0300 Subject: [PATCH] Add missing code for improved AppCDS feature Follow up of https://github.com/quarkusio/quarkus/pull/28638 as I had managed to forget to commit this part... --- .../io/quarkus/deployment/steps/MainClassBuildStep.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java index 110ff4f978e54..6371b57ef3c7c 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java @@ -53,6 +53,7 @@ import io.quarkus.deployment.configuration.RunTimeConfigurationGenerator; import io.quarkus.deployment.naming.NamingConfig; import io.quarkus.deployment.pkg.PackageConfig; +import io.quarkus.deployment.pkg.builditem.AppCDSControlPointBuildItem; import io.quarkus.deployment.pkg.builditem.AppCDSRequestedBuildItem; import io.quarkus.deployment.recording.BytecodeRecorderImpl; import io.quarkus.dev.appstate.ApplicationStateNotification; @@ -117,6 +118,7 @@ void build(List staticInitTasks, ApplicationInfoBuildItem applicationInfo, List allowJNDIBuildItems, Optional appCDSRequested, + Optional appCDSControlPoint, NamingConfig namingConfig) { appClassNameProducer.produce(new ApplicationClassNameBuildItem(Application.APP_CLASS_NAME)); @@ -191,8 +193,9 @@ void build(List staticInitTasks, mv = file.getMethodCreator("doStart", void.class, String[].class); mv.setModifiers(Modifier.PROTECTED | Modifier.FINAL); - // if AppCDS generation was requested, we ensure that the application simply loads some classes from a file and terminates - if (appCDSRequested.isPresent()) { + // if AppCDS generation was requested and no other code has requested handling of the process, + // we ensure that the application simply loads some classes from a file and terminates + if (appCDSRequested.isPresent() && appCDSControlPoint.isEmpty()) { ResultHandle createAppCDsSysProp = mv.invokeStaticMethod( ofMethod(System.class, "getProperty", String.class, String.class, String.class), mv.load(GENERATE_APP_CDS_SYSTEM_PROPERTY), mv.load("false"));