-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WFCORE-6731] Expose supported stability levels via the management API #5908
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
import java.util.EnumSet; | ||
import java.util.Locale; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.UUID; | ||
|
||
import org.jboss.as.controller.OperationContext; | ||
|
@@ -234,6 +235,7 @@ public class HostControllerEnvironment extends ProcessEnvironment { | |
|
||
private final RunningMode initialRunningMode; | ||
private final Stability stability; | ||
private final Set<Stability> stabilities; | ||
private final ProductConfig productConfig; | ||
private final String qualifiedHostName; | ||
private final String hostName; | ||
|
@@ -485,6 +487,7 @@ public HostControllerEnvironment(Map<String, String> hostSystemProperties, boole | |
this.processType = processType; | ||
|
||
this.stability = getEnumProperty(hostSystemProperties, STABILITY, this.productConfig.getDefaultStability()); | ||
this.stabilities = productConfig.getStabilitySet(); | ||
if (!this.productConfig.getStabilitySet().contains(this.stability)) { | ||
throw HostControllerLogger.ROOT_LOGGER.unsupportedStability(this.stability, this.productConfig.getProductName()); | ||
} | ||
|
@@ -808,6 +811,11 @@ public Stability getStability() { | |
return this.stability; | ||
} | ||
|
||
@Override | ||
public Set<Stability> getStabilities() { | ||
return this.stabilities; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... that way this method (and t can just delegate to ProductConfig.getStabilities(). I would also consider defining this method in ProcessEnvironment to enforce consistency across subclasses. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@pferraro @yersan This is a good idea but I think it's out of scope for this JIRA. Just because when I look at ProcessEnvironment it's an abstract class (not an interface) shares a lot of functionality with both of its subclasses, but stores and exposes no state itself and thus forces both subclasses to do so. If we're going to change that for this we should revisit all of it, which is out of scope. I have no idea why it's done this way. My only guess is ProcessEnvironment was originally stateless and over time the two subclasses evolved independently and the kind of refactoring I'm discussing here was never in scope. :) |
||
} | ||
|
||
@Override | ||
protected boolean isRuntimeSystemPropertyUpdateAllowed(String propertyName, String propertyValue, boolean bootTime) { | ||
// Currently any system-property in host.xml should not be applied to the HC runtime. This method | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -304,6 +304,7 @@ public ProcessType getProcessType() { | |
private final boolean startGracefully; | ||
private final GitRepository repository; | ||
private final Stability stability; | ||
private final Set<Stability> stabilities; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This field shouldn't be needed as this.productConfig can be called to get the stabilities set. |
||
|
||
public ServerEnvironment(final String hostControllerName, final Properties props, final Map<String, String> env, final String serverConfig, | ||
final ConfigurationFile.InteractionPolicy configInteractionPolicy, final LaunchType launchType, | ||
|
@@ -367,6 +368,7 @@ public ServerEnvironment(final String hostControllerName, final Properties props | |
domainConfigurationDir = null; | ||
repository = null; | ||
this.stability = productConfig.getDefaultStability(); | ||
this.stabilities = productConfig.getStabilitySet(); | ||
WildFlySecurityManager.setPropertyPrivileged(ServerEnvironment.JBOSS_PERSIST_SERVER_CONFIG, "false"); | ||
} else { | ||
|
||
|
@@ -523,7 +525,8 @@ public ServerEnvironment(final String hostControllerName, final Properties props | |
} | ||
|
||
this.stability = getEnumProperty(props, ProcessEnvironment.STABILITY, productConfig.getDefaultStability()); | ||
if (!productConfig.getStabilitySet().contains(this.stability)) { | ||
this.stabilities = productConfig.getStabilitySet(); | ||
if (!stabilities.contains(this.stability)) { | ||
throw ServerLogger.ROOT_LOGGER.unsupportedStability(this.stability, productConfig.getProductName()); | ||
} | ||
} | ||
|
@@ -1017,6 +1020,11 @@ public Stability getStability() { | |
return this.stability; | ||
} | ||
|
||
@Override | ||
public Set<Stability> getStabilities() { | ||
return this.stabilities; | ||
} | ||
|
||
/** | ||
* Gets whether this server is an independently managed server, not managed as part of a managed domain. | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This field shouldn't be needed as this.productConfig can be called to get the stabilities set.