Class ServerEnvironment

All Implemented Interfaces:
Serializable, FeatureFilter, FeatureRegistry

public class ServerEnvironment extends ProcessEnvironment implements Serializable
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:
  • Field Details

    • SERVICE_DESCRIPTOR

      public static final org.wildfly.service.descriptor.NullaryServiceDescriptor<ServerEnvironment> SERVICE_DESCRIPTOR
    • JAVA_EXT_DIRS

      public static final String JAVA_EXT_DIRS
      Constant that holds the name of the system property for specifying the JDK extension directory paths.
      See Also:
    • HOME_DIR

      public static final String HOME_DIR
      Constant that holds the name of the system property for specifying the JBoss home directory.
      See Also:
    • VFS_MODULE_IDENTIFIER

      public static final String VFS_MODULE_IDENTIFIER
      VFS module identifier.
      See Also:
    • SERVER_BASE_DIR

      public static final String SERVER_BASE_DIR
      Constant that holds the name of the system property for specifying the server base directory.

      Defaults to HOME_DIR/standalone.

      See Also:
    • SERVER_CONFIG_DIR

      public static final String SERVER_CONFIG_DIR
      Constant that holds the name of the system property for specifying the server configuration directory.

      Defaults to SERVER_BASE_DIR/configuration .

      See Also:
    • SERVER_DATA_DIR

      public static final String SERVER_DATA_DIR
      Constant that holds the name of the system property for specifying getServerDataDir() () the server data directory}.

      Defaults to SERVER_BASE_DIR/data.

      See Also:
    • SERVER_CONTENT_DIR

      public static final String SERVER_CONTENT_DIR
      Constant that holds the name of the system property for specifying the server managed content repository directory.

      Defaults to SERVER_DATA_DIR/content.

      See Also:
    • SERVER_LOG_DIR

      public static final String SERVER_LOG_DIR
      Constant that holds the name of the system property for specifying the server log directory.

      Defaults to SERVER_BASE_DIR/log.

      See Also:
    • SERVER_TEMP_DIR

      public static final String SERVER_TEMP_DIR
      Constant that holds the name of the system property for specifying t the server temp directory.

      Defaults to SERVER_BASE_DIR/tmp .

      See Also:
    • CONTROLLER_TEMP_DIR

      public static final String 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

      public static final String NODE_NAME
      Constant that holds the name of the system property for specifying the node name within a cluster.
      See Also:
    • SERVER_NAME

      public static final String SERVER_NAME
      Constant that holds the name of the system property for specifying the name of this server instance.
      See Also:
    • HOST_NAME

      public static final String 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

      public static final String 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

      public static final String 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

      public static final String JBOSS_BIND_ADDRESS
      The default system property used to store bind address information from the command-line (-b).
      See Also:
    • JBOSS_BIND_ADDRESS_PREFIX

      public static final String 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

      public static final String 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

      public static final String 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 -c or --server-config command line switches to explicitly set the server configuration file.
      See Also:
    • JBOSS_SERVER_MANAGEMENT_UUID

      public static final String JBOSS_SERVER_MANAGEMENT_UUID
      The system property used to set the unique identifier for this server exposed via the uuid attribute 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(forRemoval=false) public static final String JBOSS_PERSIST_SERVER_CONFIG
      Deprecated.
      for internal us only, may change or be removed at any time without notice
      The system property used to indicate whether the server was configured to persist changes to the configuration files.
      See Also:
    • DOMAIN_BASE_DIR

      public static final String DOMAIN_BASE_DIR
      See Also:
    • DOMAIN_CONFIG_DIR

      public static final String DOMAIN_CONFIG_DIR
      See Also:
  • Constructor Details

  • Method Details

    • getHostControllerName

      public String 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 be null.
      Specified by:
      getHostControllerName in class ProcessEnvironment
      Returns:
      server's host controller name if the instance is running in domain mode, or null if running in standalone mode
    • getServerName

      public String 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 via system property, or auto-detected based on host name.
      Returns:
      the server name
    • getQualifiedHostName

      public String getQualifiedHostName()
      Get the fully-qualified host name detected at server startup.
      Specified by:
      getQualifiedHostName in class ProcessEnvironment
      Returns:
      the qualified host name
    • getHostName

      public String getHostName()
      Get the local host name detected at server startup.
      Specified by:
      getHostName in class ProcessEnvironment
      Returns:
      the local host name
    • getNodeName

      public String getNodeName()
      Get the node name used for clustering purposes.
      Returns:
      the node name
    • getJavaExtDirs

      public File[] getJavaExtDirs()
      Gets any Java extension directories.
      Returns:
      the java extension directories. Will not return null, but may be an empty array
    • getHomeDir

      public File getHomeDir()
      Gets the root directory for this JBoss installation.
      Returns:
      the root directory
    • getServerBaseDir

      public File 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

      public File getServerConfigurationDir()
      Gets the directory in which server configuration files are stored.

      Defaults to getServerBaseDir() serverBaseDir}/configuration

      Returns:
      the server configuration directory.
    • getServerConfigurationFile

      public ConfigurationFile getServerConfigurationFile()
      Gets the ConfigurationFile that manages the server's configuration file.
      Returns:
      the configuration file
    • getServerDataDir

      public 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

      public File 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

      public File 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

      public File 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:
      true if the server should start in suspended mode
    • isStartGracefully

      public boolean isStartGracefully()
      Indicates whether the server should start gracefully.
      Returns:
      true if the server should start gracefully, false otherwise
    • getDomainBaseDir

      public File getDomainBaseDir()
      Gets the base directory in which managed domain files are stored.

      Defaults to JBOSS_HOME/domain

      Returns:
      the domain base directory, or null if this server is not running in a managed domain.
    • getDomainConfigurationDir

      public File getDomainConfigurationDir()
      Gets the directory in which managed domain configuration files are stored.

      Defaults to getDomainBaseDir() domainBaseDir}/configuration

      Returns:
      the domain configuration directory, or null if this server is not running in a managed domain.
    • getLaunchType

      public ServerEnvironment.LaunchType getLaunchType()
      Gets the manner in which this server was launched
      Returns:
      the launch type
    • getStability

      public Stability getStability()
      Specified by:
      getStability in interface FeatureRegistry
    • getStabilities

      public Set<Stability> getStabilities()
      Specified by:
      getStabilities in class ProcessEnvironment
    • isStandalone

      public boolean isStandalone()
      Gets whether this server is an independently managed server, not managed as part of a managed domain.
      Returns:
      true if 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:
      true if this server is self-contained
    • getInitialRunningMode

      public RunningMode getInitialRunningMode()
      Gets the RunningMode that was in effect when this server was launched.
      Returns:
      the initial running mode
    • getRunningModeControl

      public RunningModeControl getRunningModeControl()
      Get the RunningModeControl containing the current running mode of the server
      Specified by:
      getRunningModeControl in class ProcessEnvironment
      Returns:
      the running mode control
    • getProductConfig

      public ProductConfig getProductConfig()
      Gets the ProductConfig detected at startup.
      Returns:
      the product config. Will not be null
    • getInstanceUuid

      public UUID getInstanceUuid()
      Specified by:
      getInstanceUuid in class ProcessEnvironment
    • 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

      public GitRepository getGitRepository()
    • getConfigurationExtension

      public ConfigurationExtension getConfigurationExtension()
    • getBootstrapMaxThreads

      public static int getBootstrapMaxThreads()
      Determine the number of threads to use for the bootstrap service container. This reads the BOOTSTRAP_MAX_THREADS system 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

      protected String getProcessName()
      Specified by:
      getProcessName in class ProcessEnvironment
    • setProcessName

      protected void setProcessName(String processName)
      Specified by:
      setProcessName in class ProcessEnvironment
    • isRuntimeSystemPropertyUpdateAllowed

      protected boolean isRuntimeSystemPropertyUpdateAllowed(String propertyName, String propertyValue, boolean bootTime) throws OperationFailedException
      Specified by:
      isRuntimeSystemPropertyUpdateAllowed in class ProcessEnvironment
      Throws:
      OperationFailedException
    • systemPropertyUpdated

      protected void systemPropertyUpdated(String propertyName, String propertyValue)
      Specified by:
      systemPropertyUpdated in class ProcessEnvironment
    • checkStabilityIsValidForInstallation

      public void checkStabilityIsValidForInstallation(Stability stability)
    • translateFileAlias

      public static String translateFileAlias(String alias, Stability stability)