Skip to content

Commit

Permalink
[WFCORE-6753] Make ServerEnvironment.setStability() package protected
Browse files Browse the repository at this point in the history
  • Loading branch information
kabir committed Apr 9, 2024
1 parent bbff9b0 commit 1702471
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1190,8 +1190,7 @@ private void checkStabilityIsValidForInstallation(ProductConfig productConfig, S
}
}

// TODO Figure out how to make this package protected
public void setStability(Stability stability) {
void setStability(Stability stability) {
WildFlySecurityManager.setPropertyPrivileged(ProcessEnvironment.STABILITY, stability.toString());
this.stability = stability;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*/

package org.jboss.as.server;

import org.jboss.as.controller.ControlledProcessState;
import org.jboss.as.controller.RunningModeControl;
import org.jboss.as.controller.operations.common.ProcessReloadHandler;
import org.jboss.as.version.Stability;
import org.jboss.msc.service.ServiceName;

public abstract class ServerEnvironmentAwareProcessReloadHandler extends ProcessReloadHandler<RunningModeControl> {
protected final ServerEnvironment environment;

public ServerEnvironmentAwareProcessReloadHandler(ServiceName rootService, RunningModeControl runningModeControl, ControlledProcessState processState, ServerEnvironment environment) {
super(rootService, runningModeControl, processState);
this.environment = environment;
}

protected void updateServerEnvironmentStability(Stability stability) {
environment.setStability(stability);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.as.controller.persistence.ExtensibleConfigurationPersister;
import org.jboss.as.server.ServerEnvironment;
import org.jboss.as.server.ServerEnvironmentAwareProcessReloadHandler;
import org.jboss.as.server.Services;
import org.jboss.as.server.controller.descriptions.ServerDescriptions;
import org.jboss.as.server.logging.ServerLogger;
Expand All @@ -39,7 +40,7 @@
*
* @author <a href="[email protected]">Kabir Khan</a>
*/
public class ServerProcessReloadHandler extends ProcessReloadHandler<RunningModeControl> {
public class ServerProcessReloadHandler extends ServerEnvironmentAwareProcessReloadHandler {

private static final AttributeDefinition USE_CURRENT_SERVER_CONFIG = new SimpleAttributeDefinitionBuilder(ModelDescriptionConstants.USE_CURRENT_SERVER_CONFIG, ModelType.BOOLEAN, true)
.setAlternatives(ModelDescriptionConstants.SERVER_CONFIG)
Expand Down Expand Up @@ -84,14 +85,12 @@ public class ServerProcessReloadHandler extends ProcessReloadHandler<RunningMode
.build();

private final Set<String> additionalAttributes;
private final ServerEnvironment environment;
private ExtensibleConfigurationPersister extensibleConfigurationPersister;

public ServerProcessReloadHandler(ServiceName rootService, RunningModeControl runningModeControl,
ControlledProcessState processState, ServerEnvironment environment, Set<String> additionalAttributes, ExtensibleConfigurationPersister extensibleConfigurationPersister) {
super(rootService, runningModeControl, processState);
super(rootService, runningModeControl, processState, environment);
this.additionalAttributes = additionalAttributes == null ? Collections.emptySet() : additionalAttributes;
this.environment = environment;
this.extensibleConfigurationPersister = extensibleConfigurationPersister;
}

Expand Down Expand Up @@ -178,7 +177,7 @@ public void doReload(RunningModeControl runningModeControl) {
runningModeControl.setNewBootFileName(serverConfig);
runningModeControl.setSuspend(finalSuspend);
if (stability != null) {
environment.setStability(stability);
updateServerEnvironmentStability(stability);
}
runningModeControl.setApplyConfigurationExtension(applyConfigurationExtension);
}
Expand Down

0 comments on commit 1702471

Please sign in to comment.