diff --git a/nucleus/common/glassfish-api/src/main/java/org/glassfish/api/deployment/DeployCommandParameters.java b/nucleus/common/glassfish-api/src/main/java/org/glassfish/api/deployment/DeployCommandParameters.java index a4d451ef92d..4b6d296adfe 100644 --- a/nucleus/common/glassfish-api/src/main/java/org/glassfish/api/deployment/DeployCommandParameters.java +++ b/nucleus/common/glassfish-api/src/main/java/org/glassfish/api/deployment/DeployCommandParameters.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -// Portions Copyright [2016-2020] [Payara Foundation and/or its affiliates] +// Portions Copyright [2016-2024] [Payara Foundation and/or its affiliates] package org.glassfish.api.deployment; @@ -303,6 +303,7 @@ public static class ParameterNames { public static final String DEPLOYMENT_ORDER = "deploymentorder"; public static final String ALT_DD = "altdd"; public static final String RUNTIME_ALT_DD = "runtimealtdd"; + public static final String KEEP_STATE = "keepState"; public static final String HOT_DEPLOY = "hotdeploy"; public static final String SOURCES_CHANGED = "sourceschanged"; public static final String METADATA_CHANGED = "metadatachanged"; diff --git a/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/DynamicReloader.java b/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/DynamicReloader.java index 777ff6b5734..a04671a5c94 100644 --- a/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/DynamicReloader.java +++ b/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/DynamicReloader.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -// Portions Copyright [2016-2021] [Payara Foundation and/or its affiliates] +// Portions Copyright [2016-2024] [Payara Foundation and/or its affiliates] package com.sun.enterprise.v3.server; @@ -48,7 +48,6 @@ import com.sun.enterprise.admin.report.XMLActionReporter; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.URI; @@ -61,7 +60,6 @@ import java.util.Properties; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.logging.Level; import java.util.logging.Logger; import javax.security.auth.Subject; import org.glassfish.api.admin.ParameterMap; @@ -251,6 +249,7 @@ private void reloadApp(AppReloadInfo appInfo) throws IOException { deployParam.set(DeploymentProperties.KEEP_REPOSITORY_DIRECTORY, "true"); Properties reloadFile = appInfo.readReloadFile(); + boolean keepState = Boolean.parseBoolean(reloadFile.getProperty(DeployCommandParameters.ParameterNames.KEEP_STATE)); boolean hotDeploy = Boolean.parseBoolean(reloadFile.getProperty(DeployCommandParameters.ParameterNames.HOT_DEPLOY)); if (hotDeploy) { deployParam.set(DeployCommandParameters.ParameterNames.HOT_DEPLOY, "true"); @@ -263,6 +262,9 @@ private void reloadApp(AppReloadInfo appInfo) throws IOException { deployParam.set(DeployCommandParameters.ParameterNames.SOURCES_CHANGED, sourcesChanged); } } + if(keepState) { + deployParam.set(DeployCommandParameters.ParameterNames.KEEP_STATE, "true"); + } commandRunner.getCommandInvocation("deploy", new XMLActionReporter(), kernelSubject).parameters(deployParam).execute(); appInfo.recordLoad();