Package org.jboss.as.server
Class ServerEnvironment
java.lang.Object
org.jboss.as.controller.operations.common.ProcessEnvironment
org.jboss.as.server.ServerEnvironment
- All Implemented Interfaces:
Serializable,FeatureFilter,FeatureRegistry
Encapsulates the runtime environment for a server.
This is parsed when the server is initially started, a process reload reuses the server environment.
- Author:
- Brian Stansberry, Mike M. Clark
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe manner in which a server can be launchedNested classes/interfaces inherited from class org.jboss.as.controller.operations.common.ProcessEnvironment
ProcessEnvironment.ProcessNameWriteAttributeHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstant that holds the name of the system property for specifying the max threads used by the bootstrap ServiceContainer.static final StringCommon alias between domain and standalone mode.static final Stringstatic final Stringstatic final StringConstant that holds the name of the system property for specifyingthe JBoss home directory.static final StringConstant that holds the name of the system property for specifying the local part of the name of the host machine that this server is running on.static final StringConstant that holds the name of the system property for specifying the JDK extension directory paths.static final StringThe default system property used to store bind address information from the command-line (-b).static final StringPrefix for the system property used to store qualified bind address information from the command-line (-bxxx).static final StringThe default system property used to store bind address information from the command-line (-b).static final StringDeprecated.for internal us only, may change or be removed at any time without noticestatic final StringThe system property used to store the name of the default server configuration file.static final StringThe system property used to set the unique identifier for this server exposed via theuuidattribute of the server's root management resource.static final StringConstant that holds the name of the system property for specifying the node name within a cluster.static final StringConstant that holds the name of the system property for specifying the fully-qualified name of the host machine that this server is running on.static final StringConstant that holds the name of the system property for specifyingthe server base directory.static final StringConstant that holds the name of the system property for specifyingthe server configuration directory.static final StringConstant that holds the name of the system property for specifyingthe server managed content repository directory.static final StringConstant that holds the name of the system property for specifyinggetServerDataDir()() the server data directory}.static final StringConstant that holds the name of the system property for specifyingthe server log directory.static final StringConstant that holds the name of the system property for specifying the name of this server instance.static final StringConstant that holds the name of the system property for specifying tthe server temp directory.static final org.wildfly.service.descriptor.NullaryServiceDescriptor<ServerEnvironment>static final StringVFS module identifier.Fields inherited from class org.jboss.as.controller.operations.common.ProcessEnvironment
JBOSS_DOMAIN_UUID, KERNEL_DIR, NAME, STABILITY, UUID_FILE -
Constructor Summary
ConstructorsConstructorDescriptionServerEnvironment(String hostControllerName, Properties props, Map<String, String> env, String serverConfig, ConfigurationFile.InteractionPolicy configInteractionPolicy, ServerEnvironment.LaunchType launchType, RunningMode initialRunningMode, ProductConfig productConfig, boolean startSuspended) Only for test casesServerEnvironment(String hostControllerName, Properties props, Map<String, String> env, String serverConfig, ConfigurationFile.InteractionPolicy configurationInteractionPolicy, ServerEnvironment.LaunchType launchType, RunningMode initialRunningMode, ProductConfig productConfig, long startTime, boolean startSuspended, boolean startGracefully, String gitRepository, String gitBranch, String gitAuthConfiguration, String supplementalConfiguration) Deprecated, for removal: This API element is subject to removal in a future version.use the variant that takes anelapsedTimeparameter instead oflong startTimeServerEnvironment(String hostControllerName, Properties props, Map<String, String> env, String serverConfig, ConfigurationFile.InteractionPolicy configurationInteractionPolicy, ServerEnvironment.LaunchType launchType, RunningMode initialRunningMode, ProductConfig productConfig, ElapsedTime elapsedTime, boolean startSuspended, boolean startGracefully, String gitRepository, String gitBranch, String gitAuthConfiguration, String supplementalConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckStabilityIsValidForInstallation(Stability stability) static intDetermine the number of threads to use for the bootstrap service container.Gets the base directory in which managed domain files are stored.Gets the directory in which managed domain configuration files are stored.Gets the root directory for this JBoss installation.Get the name of this server's host controller.Get the local host name detected at server startup.Gets theRunningModethat was in effect when this server was launched.File[]Gets any Java extension directories.Gets the manner in which this server was launchedGet the node name used for clustering purposes.protected StringGets theProductConfigdetected at startup.Get the fully-qualified host name detected at server startup.Get theRunningModeControlcontaining the current running mode of the serverGets the based directory for this server.Gets the directory in which server configuration files are stored.Gets theConfigurationFilethat manages the server's configuration file.Gets the directory in which the server will store server-managed user content (e.g. deployments.)Gets the directory in which the server can store private internal state that should survive a process restart.Gets the directory in which the server can write log files.Get the name of this server instance.Gets the directory in which athe server can store private internal state that does not need to survive a process restart.longGets the time when this process was started.protected booleanisRuntimeSystemPropertyUpdateAllowed(String propertyName, String propertyValue, boolean bootTime) booleanGets whether this server is a self-contained (no filesystem layout) or not.booleanGets whether this server is an independently managed server, not managed as part of a managed domain.booleanIndicates whether the server should start gracefully.booleanIf this is true then the server will start in suspended modeprotected voidsetProcessName(String processName) protected voidsystemPropertyUpdated(String propertyName, String propertyValue) static StringtranslateFileAlias(String alias, Stability stability) booleanuseGit()Methods inherited from class org.jboss.as.controller.operations.common.ProcessEnvironment
getProcessNameReadHandler, getProcessNameWriteHandler, obtainProcessUUID, resolveGUIDMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jboss.as.controller.FeatureRegistry
enables
-
Field Details
-
SERVICE_DESCRIPTOR
public static final org.wildfly.service.descriptor.NullaryServiceDescriptor<ServerEnvironment> SERVICE_DESCRIPTOR -
JAVA_EXT_DIRS
Constant that holds the name of the system property for specifying the JDK extension directory paths.- See Also:
-
HOME_DIR
Constant that holds the name of the system property for specifyingthe JBoss home directory.- See Also:
-
VFS_MODULE_IDENTIFIER
VFS module identifier.- See Also:
-
SERVER_BASE_DIR
Constant that holds the name of the system property for specifyingthe server base directory.Defaults to HOME_DIR/standalone.
- See Also:
-
SERVER_CONFIG_DIR
Constant that holds the name of the system property for specifyingthe server configuration directory.Defaults to SERVER_BASE_DIR/configuration .
- See Also:
-
SERVER_DATA_DIR
Constant that holds the name of the system property for specifyinggetServerDataDir()() the server data directory}.Defaults to SERVER_BASE_DIR/data.
- See Also:
-
SERVER_CONTENT_DIR
Constant that holds the name of the system property for specifyingthe server managed content repository directory.Defaults to SERVER_DATA_DIR/content.
- See Also:
-
SERVER_LOG_DIR
Constant that holds the name of the system property for specifyingthe server log directory.Defaults to SERVER_BASE_DIR/log.
- See Also:
-
SERVER_TEMP_DIR
Constant that holds the name of the system property for specifying tthe server temp directory.Defaults to SERVER_BASE_DIR/tmp .
- See Also:
-
CONTROLLER_TEMP_DIR
Common alias between domain and standalone mode. Equivalent to jboss.domain.temp.dir in a managed domain, and jboss.server.temp.dir on a standalone server.- See Also:
-
NODE_NAME
Constant that holds the name of the system property for specifying the node name within a cluster.- See Also:
-
SERVER_NAME
Constant that holds the name of the system property for specifying the name of this server instance.- See Also:
-
HOST_NAME
Constant that holds the name of the system property for specifying the local part of the name of the host machine that this server is running on.- See Also:
-
QUALIFIED_HOST_NAME
Constant that holds the name of the system property for specifying the fully-qualified name of the host machine that this server is running on.- See Also:
-
BOOTSTRAP_MAX_THREADS
Constant that holds the name of the system property for specifying the max threads used by the bootstrap ServiceContainer.- See Also:
-
JBOSS_BIND_ADDRESS
The default system property used to store bind address information from the command-line (-b).- See Also:
-
JBOSS_BIND_ADDRESS_PREFIX
Prefix for the system property used to store qualified bind address information from the command-line (-bxxx).- See Also:
-
JBOSS_DEFAULT_MULTICAST_ADDRESS
The default system property used to store bind address information from the command-line (-b).- See Also:
-
JBOSS_SERVER_DEFAULT_CONFIG
The system property used to store the name of the default server configuration file. If not set, the default domain configuration file is "standalone.xml". The default domain configuration file is only relevant if the user does not use the-cor--server-configcommand line switches to explicitly set the server configuration file.- See Also:
-
JBOSS_SERVER_MANAGEMENT_UUID
The system property used to set the unique identifier for this server exposed via theuuidattribute of the server's root management resource. If the property is not set any previously persisted UUID will be used; otherwise a random UUID will be generated.- See Also:
-
JBOSS_PERSIST_SERVER_CONFIG
Deprecated.for internal us only, may change or be removed at any time without noticeThe system property used to indicate whether the server was configured to persist changes to the configuration files.- See Also:
-
DOMAIN_BASE_DIR
- See Also:
-
DOMAIN_CONFIG_DIR
- See Also:
-
-
Constructor Details
-
ServerEnvironment
public ServerEnvironment(String hostControllerName, Properties props, Map<String, String> env, String serverConfig, ConfigurationFile.InteractionPolicy configInteractionPolicy, ServerEnvironment.LaunchType launchType, RunningMode initialRunningMode, ProductConfig productConfig, boolean startSuspended) Only for test cases -
ServerEnvironment
@Deprecated(forRemoval=true) public ServerEnvironment(String hostControllerName, Properties props, Map<String, String> env, String serverConfig, ConfigurationFile.InteractionPolicy configurationInteractionPolicy, ServerEnvironment.LaunchType launchType, RunningMode initialRunningMode, ProductConfig productConfig, long startTime, boolean startSuspended, boolean startGracefully, String gitRepository, String gitBranch, String gitAuthConfiguration, String supplementalConfiguration) Deprecated, for removal: This API element is subject to removal in a future version.use the variant that takes anelapsedTimeparameter instead oflong startTime -
ServerEnvironment
public ServerEnvironment(String hostControllerName, Properties props, Map<String, String> env, String serverConfig, ConfigurationFile.InteractionPolicy configurationInteractionPolicy, ServerEnvironment.LaunchType launchType, RunningMode initialRunningMode, ProductConfig productConfig, ElapsedTime elapsedTime, boolean startSuspended, boolean startGracefully, String gitRepository, String gitBranch, String gitAuthConfiguration, String supplementalConfiguration)
-
-
Method Details
-
getHostControllerName
Get the name of this server's host controller. For domain-mode servers, this is the name given in the domain configuration. For standalone servers, which do not utilize a host controller, the value should benull.- Specified by:
getHostControllerNamein classProcessEnvironment- Returns:
- server's host controller name if the instance is running in domain mode, or
nullif running in standalone mode
-
getServerName
Get the name of this server instance. For domain-mode servers, this is the name given in the domain configuration. For standalone servers, this is the name either provided in the server configuration, or, if not given, the name specified viasystem property, or auto-detected based onhost name.- Returns:
- the server name
-
getQualifiedHostName
Get the fully-qualified host name detected at server startup.- Specified by:
getQualifiedHostNamein classProcessEnvironment- Returns:
- the qualified host name
-
getHostName
Get the local host name detected at server startup.- Specified by:
getHostNamein classProcessEnvironment- Returns:
- the local host name
-
getNodeName
Get the node name used for clustering purposes.- Returns:
- the node name
-
getJavaExtDirs
Gets any Java extension directories.- Returns:
- the java extension directories. Will not return
null, but may be an empty array
-
getHomeDir
Gets the root directory for this JBoss installation.- Returns:
- the root directory
-
getServerBaseDir
Gets the based directory for this server.Defaults to
homeDir/standalone for a standalone server or domain/servers/<server-name> for a managed domain server.- Returns:
- the base directory for the server
-
getServerConfigurationDir
Gets the directory in which server configuration files are stored.Defaults to
getServerBaseDir()serverBaseDir}/configuration- Returns:
- the server configuration directory.
-
getServerConfigurationFile
Gets theConfigurationFilethat manages the server's configuration file.- Returns:
- the configuration file
-
getServerDataDir
Gets the directory in which the server can store private internal state that should survive a process restart.Defaults to
getServerBaseDir()serverBaseDir}/data- Returns:
- the internal state persistent storage directory
-
getServerContentDir
Gets the directory in which the server will store server-managed user content (e.g. deployments.)Defaults to
getServerDataDir()serverDataDir}/content- Returns:
- the domain managed content storage directory
-
getServerLogDir
Gets the directory in which the server can write log files.Defaults to
getServerBaseDir()serverBaseDir}/log- Returns:
- the log file directory for the server.
-
getServerTempDir
Gets the directory in which athe server can store private internal state that does not need to survive a process restart.Defaults to
getServerBaseDir()serverBaseDir}/tmp- Returns:
- the internal state temporary storage directory for the server.
-
isStartSuspended
public boolean isStartSuspended()If this is true then the server will start in suspended mode- Returns:
trueif the server should start in suspended mode
-
isStartGracefully
public boolean isStartGracefully()Indicates whether the server should start gracefully.- Returns:
trueif the server should start gracefully, false otherwise
-
getDomainBaseDir
Gets the base directory in which managed domain files are stored.Defaults to
JBOSS_HOME/domain- Returns:
- the domain base directory, or
nullif this server is not running in a managed domain.
-
getDomainConfigurationDir
Gets the directory in which managed domain configuration files are stored.Defaults to
getDomainBaseDir()domainBaseDir}/configuration- Returns:
- the domain configuration directory, or
nullif this server is not running in a managed domain.
-
getLaunchType
Gets the manner in which this server was launched- Returns:
- the launch type
-
getStability
- Specified by:
getStabilityin interfaceFeatureRegistry
-
getStabilities
- Specified by:
getStabilitiesin classProcessEnvironment
-
isStandalone
public boolean isStandalone()Gets whether this server is an independently managed server, not managed as part of a managed domain.- Returns:
trueif this server is an independently managed server
-
isSelfContained
public boolean isSelfContained()Gets whether this server is a self-contained (no filesystem layout) or not.- Returns:
trueif this server is self-contained
-
getInitialRunningMode
Gets theRunningModethat was in effect when this server was launched.- Returns:
- the initial running mode
-
getRunningModeControl
Get theRunningModeControlcontaining the current running mode of the server- Specified by:
getRunningModeControlin classProcessEnvironment- Returns:
- the running mode control
-
getProductConfig
Gets theProductConfigdetected at startup.- Returns:
- the product config. Will not be
null
-
getInstanceUuid
- Specified by:
getInstanceUuidin classProcessEnvironment
-
getStartTime
public long getStartTime()Gets the time when this process was started. Note that a process reload does not change this value.- Returns:
- the time, in ms since the epoch
-
useGit
public boolean useGit() -
getGitRepository
-
getConfigurationExtension
-
getBootstrapMaxThreads
public static int getBootstrapMaxThreads()Determine the number of threads to use for the bootstrap service container. This reads theBOOTSTRAP_MAX_THREADSsystem property and if not set, defaults to 2*cpus.- Returns:
- the maximum number of threads to use for the bootstrap service container.
- See Also:
-
getProcessName
- Specified by:
getProcessNamein classProcessEnvironment
-
setProcessName
- Specified by:
setProcessNamein classProcessEnvironment
-
isRuntimeSystemPropertyUpdateAllowed
protected boolean isRuntimeSystemPropertyUpdateAllowed(String propertyName, String propertyValue, boolean bootTime) throws OperationFailedException - Specified by:
isRuntimeSystemPropertyUpdateAllowedin classProcessEnvironment- Throws:
OperationFailedException
-
systemPropertyUpdated
- Specified by:
systemPropertyUpdatedin classProcessEnvironment
-
checkStabilityIsValidForInstallation
-
translateFileAlias
-