diff --git a/cli/src/main/java/org/jboss/as/cli/Util.java b/cli/src/main/java/org/jboss/as/cli/Util.java index 9dae435341c..024098a0b58 100644 --- a/cli/src/main/java/org/jboss/as/cli/Util.java +++ b/cli/src/main/java/org/jboss/as/cli/Util.java @@ -230,7 +230,6 @@ public class Util { public static final String RELEASE_CODENAME = "release-codename"; public static final String RELEASE_VERSION = "release-version"; public static final String RELOAD = "reload"; - public static final String RELOAD_ENHANCED = "reload-enhanced"; public static final String REMOVE = "remove"; public static final String REPLY_PROPERTIES = "reply-properties"; public static final String REQUEST_PROPERTIES = "request-properties"; diff --git a/controller/src/main/java/org/jboss/as/controller/RunningModeControl.java b/controller/src/main/java/org/jboss/as/controller/RunningModeControl.java index b86220ea882..4274c9ff3d0 100644 --- a/controller/src/main/java/org/jboss/as/controller/RunningModeControl.java +++ b/controller/src/main/java/org/jboss/as/controller/RunningModeControl.java @@ -5,8 +5,6 @@ package org.jboss.as.controller; -import org.jboss.as.version.Stability; - /** * Provides control over the server's current {@link RunningMode}. * @@ -20,11 +18,6 @@ public class RunningModeControl { private volatile String newBootFileName; private volatile Boolean suspend; - - // Temporary experiment for the testsuite - @Deprecated - private volatile Stability reloadedStability; - public RunningModeControl(final RunningMode initialMode) { this.runningMode = initialMode; } @@ -89,21 +82,4 @@ public void setNewBootFileName(String newBootFileName) { this.newBootFileName = newBootFileName; } - /** - * Gets the stability of the reloaded server. - * - * @return the stability of the reloaded server - */ - public Stability getReloadedStability() { - return reloadedStability; - } - - /** - * Sets the stability of the reloaded server. - * - * @param reloadedStability the stability of the reloaded server - */ - public void setReloadedStability(Stability reloadedStability) { - this.reloadedStability = reloadedStability; - } } diff --git a/server/src/main/java/org/jboss/as/server/ApplicationServerService.java b/server/src/main/java/org/jboss/as/server/ApplicationServerService.java index 2bc23d9916d..a67f628e8a9 100644 --- a/server/src/main/java/org/jboss/as/server/ApplicationServerService.java +++ b/server/src/main/java/org/jboss/as/server/ApplicationServerService.java @@ -52,7 +52,7 @@ final class ApplicationServerService implements Service> { private final List extraServices; - private volatile Bootstrap.Configuration configuration; + private final Bootstrap.Configuration configuration; private final RunningModeControl runningModeControl; private final ControlledProcessState processState; private final SuspendController suspendController; @@ -78,14 +78,7 @@ public synchronized void start(final StartContext context) throws StartException //Moved to AbstractControllerService.start() //processState.setStarting(); - final Bootstrap.Configuration configuration; - Bootstrap.Configuration recalculatedConfiguration = this.configuration.recalculateForReload(runningModeControl); - if (recalculatedConfiguration != this.configuration) { - this.configuration = recalculatedConfiguration; - configuration = recalculatedConfiguration; - } else { - configuration = this.configuration; - } + final Bootstrap.Configuration configuration = this.configuration; final ServerEnvironment serverEnvironment = configuration.getServerEnvironment(); final ProductConfig config = serverEnvironment.getProductConfig(); final String prettyVersion = config.getPrettyVersionString(); diff --git a/server/src/main/java/org/jboss/as/server/Bootstrap.java b/server/src/main/java/org/jboss/as/server/Bootstrap.java index eb5ec95042d..e43d918bcbe 100644 --- a/server/src/main/java/org/jboss/as/server/Bootstrap.java +++ b/server/src/main/java/org/jboss/as/server/Bootstrap.java @@ -7,7 +7,6 @@ import java.util.List; import java.util.concurrent.ExecutorService; -import java.util.concurrent.atomic.AtomicReference; import javax.xml.namespace.QName; @@ -24,7 +23,6 @@ import org.jboss.as.server.controller.git.GitConfigurationPersister; import org.jboss.as.controller.persistence.XmlConfigurationPersister; import org.jboss.as.server.parsing.StandaloneXml; -import org.jboss.as.version.Stability; import org.jboss.modules.Module; import org.jboss.modules.ModuleLoader; import org.jboss.msc.service.ServiceActivator; @@ -81,12 +79,11 @@ final class Configuration { private final DelegatingConfigurableAuthorizer authorizer; private final ManagementSecurityIdentitySupplier securityIdentitySupplier; - // Used to update the stability in the supplier cached by the ExtensionRegistry - private final AtomicReference stabilityReference; private ModuleLoader moduleLoader = Module.getBootModuleLoader(); private ConfigurationPersisterFactory configurationPersisterFactory; private long startTime; + public Configuration(final ServerEnvironment serverEnvironment) { assert serverEnvironment != null : "serverEnvironment is null"; this.serverEnvironment = serverEnvironment; @@ -94,10 +91,9 @@ public Configuration(final ServerEnvironment serverEnvironment) { this.auditLogger = serverEnvironment.createAuditLogger(); this.authorizer = new DelegatingConfigurableAuthorizer(); this.securityIdentitySupplier = new ManagementSecurityIdentitySupplier(); - this.stabilityReference = new AtomicReference<>(serverEnvironment.getStability()); this.extensionRegistry = ExtensionRegistry.builder(serverEnvironment.getLaunchType().getProcessType()) .withRunningModeControl(this.runningModeControl) - .withStabilitySupplier(stabilityReference::get) + .withStabilitySupplier(serverEnvironment::getStability) .withAuditLogger(this.auditLogger) .withAuthorizer(this.authorizer) .withSecurityIdentitySupplier(this.securityIdentitySupplier) @@ -106,25 +102,6 @@ public Configuration(final ServerEnvironment serverEnvironment) { this.startTime = serverEnvironment.getStartTime(); } - private Configuration(final Configuration original, ServerEnvironment serverEnvironment) { - // Updating the server environment here, will update the value - this.serverEnvironment = serverEnvironment; - this.extensionRegistry = original.extensionRegistry; - this.runningModeControl = original.runningModeControl; - this.capabilityRegistry = original.capabilityRegistry; - this.auditLogger = original.auditLogger; - this.authorizer = original.authorizer; - this.securityIdentitySupplier = original.securityIdentitySupplier; - - // The extension registry caches the stability supplier so update its value here - this.stabilityReference = original.stabilityReference; - this.stabilityReference.set(this.serverEnvironment.getStability()); - - this.moduleLoader = original.moduleLoader; - this.configurationPersisterFactory = original.configurationPersisterFactory; - this.startTime = original.startTime; - } - /** * Get the server environment. * @@ -260,16 +237,6 @@ public synchronized void setConfigurationPersisterFactory(final ConfigurationPer public long getStartTime() { return startTime; } - - Configuration recalculateForReload(RunningModeControl runningModeControl) { - if (runningModeControl.isReloaded()) { - ServerEnvironment recalculatedServerEnvironment = serverEnvironment.recalculateForReload(runningModeControl); - if (recalculatedServerEnvironment != serverEnvironment) { - return new Configuration(this, recalculatedServerEnvironment); - } - } - return this; - } } /** A factory for the {@link ExtensibleConfigurationPersister} to be used by this server */ diff --git a/server/src/main/java/org/jboss/as/server/ServerEnvironment.java b/server/src/main/java/org/jboss/as/server/ServerEnvironment.java index 733359c80ca..6496f0191d1 100644 --- a/server/src/main/java/org/jboss/as/server/ServerEnvironment.java +++ b/server/src/main/java/org/jboss/as/server/ServerEnvironment.java @@ -303,7 +303,7 @@ public ProcessType getProcessType() { private final boolean startSuspended; private final boolean startGracefully; private final GitRepository repository; - private final Stability stability; + private volatile Stability stability; public ServerEnvironment(final String hostControllerName, final Properties props, final Map env, final String serverConfig, final ConfigurationFile.InteractionPolicy configInteractionPolicy, final LaunchType launchType, @@ -523,9 +523,7 @@ public ServerEnvironment(final String hostControllerName, final Properties props } this.stability = getEnumProperty(props, ProcessEnvironment.STABILITY, productConfig.getDefaultStability()); - if (!productConfig.getStabilitySet().contains(this.stability)) { - throw ServerLogger.ROOT_LOGGER.unsupportedStability(this.stability, productConfig.getProductName()); - } + checkStabilityIsValidForInstallation(productConfig, this.stability); } boolean allowExecutor = true; String maxThreads = WildFlySecurityManager.getPropertyPrivileged(BOOTSTRAP_MAX_THREADS, null); @@ -589,41 +587,6 @@ public ServerEnvironment(final String hostControllerName, final Properties props } } - private ServerEnvironment(ServerEnvironment original, Stability stability) { - this.primordialProperties = original.primordialProperties; - this.providedProperties = original.providedProperties; - this.processNameSet = original.processNameSet; - this.launchType = original.launchType; - this.hostControllerName = original.hostControllerName; - this.qualifiedHostName = original.qualifiedHostName; - this.hostName = original.hostName; - this.serverName = original.serverName; - this.nodeName = original.nodeName; - this.javaExtDirs = original.javaExtDirs; - this.homeDir = original.homeDir; - this.serverBaseDir = original.serverBaseDir; - this.serverConfigurationDir = original.serverConfigurationDir; - this.serverConfigurationFile = original.serverConfigurationFile; - this.serverLogDir = original.serverLogDir; - this.controllerTempDir = original.controllerTempDir; - this.serverDataDir = original.serverDataDir; - this.serverContentDir = original.serverContentDir; - this.serverTempDir = original.serverTempDir; - this.domainBaseDir = original.domainBaseDir; - this.domainConfigurationDir = original.domainConfigurationDir; - this.standalone = original.standalone; - this.allowModelControllerExecutor = original.allowModelControllerExecutor; - this.initialRunningMode = original.initialRunningMode; - this.productConfig = original.productConfig; - this.runningModeControl = original.runningModeControl; - this.serverUUID = original.serverUUID; - this.startTime = original.startTime; - this.startSuspended = original.startSuspended; - this.startGracefully = original.startGracefully; - this.repository = original.repository; - this.stability = stability; - } - private Set listIgnoredFiles(String defaultServerConfig) { Set ignored = new LinkedHashSet<>(); setIgnored(ignored, serverDataDir.toPath(), true, false); @@ -1205,6 +1168,23 @@ protected void systemPropertyUpdated(String propertyName, String propertyValue) } } + + public void checkStabilityIsValidForInstallation(Stability stability) { + checkStabilityIsValidForInstallation(productConfig, stability); + } + + private void checkStabilityIsValidForInstallation(ProductConfig productConfig, Stability stability) { + if (!productConfig.getStabilitySet().contains(stability)) { + throw ServerLogger.ROOT_LOGGER.unsupportedStability(this.stability, productConfig.getProductName()); + } + } + + // TODO Figure out how to make this package protected + public void setStability(Stability stability) { + WildFlySecurityManager.setPropertyPrivileged(ProcessEnvironment.STABILITY, stability.toString()); + this.stability = stability; + } + /** * Get a File from configuration. * @@ -1277,16 +1257,4 @@ private File[] getFilesFromProperty(final String name, final Properties props) { ManagedAuditLogger createAuditLogger() { return new ManagedAuditLoggerImpl(getProductConfig().resolveVersion(), true); } - - ServerEnvironment recalculateForReload(RunningModeControl runningModeControl) { - if (runningModeControl.isReloaded()) { - Stability stability = runningModeControl.getReloadedStability() != null ? runningModeControl.getReloadedStability() : this.stability; - if (stability != this.stability) { - System.setProperty(ProcessEnvironment.STABILITY, stability.toString()); - - return new ServerEnvironment(this, stability); - } - } - return this; - } } diff --git a/server/src/main/java/org/jboss/as/server/operations/ServerProcessReloadHandler.java b/server/src/main/java/org/jboss/as/server/operations/ServerProcessReloadHandler.java index 7d681634225..a57c2af6d18 100644 --- a/server/src/main/java/org/jboss/as/server/operations/ServerProcessReloadHandler.java +++ b/server/src/main/java/org/jboss/as/server/operations/ServerProcessReloadHandler.java @@ -124,6 +124,7 @@ protected ProcessReloadHandler.ReloadContext initializeReloa if (additionalAttributes.contains(ModelDescriptionConstants.STABILITY) && operation.hasDefined(ModelDescriptionConstants.STABILITY)) { String val = STABILITY.resolveModelAttribute(context, operation).asString(); stability = Stability.fromString(val); + environment.checkStabilityIsValidForInstallation(stability); } else { stability = null; } @@ -164,15 +165,15 @@ public void reloadInitiated(RunningModeControl runningModeControl) { @Override public void doReload(RunningModeControl runningModeControl) { - // If no stability is specified, use the current stability - Stability reloadedStability = stability == null ? environment.getStability() : stability; - runningModeControl.setRunningMode(finalAdminOnly ? RunningMode.ADMIN_ONLY : RunningMode.NORMAL); runningModeControl.setReloaded(); - runningModeControl.setReloadedStability(reloadedStability); runningModeControl.setUseCurrentConfig(useCurrentConfig); runningModeControl.setNewBootFileName(serverConfig); runningModeControl.setSuspend(finalSuspend); + + if (stability != null) { + environment.setStability(stability); + } } }; }