Class ServerEnvironment

  • All Implemented Interfaces:
    Serializable

    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:
    Serialized Form
    • Field Detail

      • 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:
        Constant Field Values
      • MODULES_DIR

        @Deprecated
        public static final String MODULES_DIR
        Deprecated.
        has no useful meaning
        Constant that holds the name of the system property for specifying the directory returned from getModulesDir().

        Defaults to HOME_DIR/modules/

        This system property has no real meaning and should not be regarded as providing any sort of useful information. The "modules" directory is the default location from which JBoss Modules looks to find modules. However, this behavior is in no way controlled by this system property, nor is it guaranteed that modules will be loaded from only one directory, nor is it guaranteed that the "modules" directory will be one of the directories used. Finally, the structure and contents of any directories from which JBoss Modules loads resources is not something available from this class. Users wishing to interact with the modular classloading system should use the APIs provided by JBoss Modules
        See Also:
        Constant Field Values
      • SERVER_CONFIG_DIR

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

        Defaults to SERVER_BASE_DIR/configuration .

        See Also:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • JBOSS_PERSIST_SERVER_CONFIG

        @Deprecated
        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:
        Constant Field Values
    • Method Detail

      • 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 getHostName() 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
      • getModulesDir

        @Deprecated
        public File getModulesDir()
        Deprecated.
        has no reliable meaning
        A filesystem location that has no real meaning and should not be regarded as providing any sort of useful information. The "modules" directory is the default location from which JBoss Modules looks to find modules. However, this behavior is in no way controlled by the value returned by this method, nor is it guaranteed that modules will be loaded from only one directory, nor is it guaranteed that the "modules" directory will be one of the directories used. Finally, the structure and contents of any directories from which JBoss Modules loads resources is not something available from this class. Users wishing to interact with the modular classloading system should use the APIs provided by JBoss Modules.
        Returns:
        a file
      • getBundlesDir

        public File getBundlesDir()
        Gets the directory under which OSGi bundles should be located.

        Defaults to homeDir/bundles

        Returns:
        the bundles directory
      • getServerBaseDir

        public File getServerBaseDir()
        Gets the based directory for this server.

        Defaults to homeDir/standalone for a standalone server or domain/servers/ 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()
        If this is true then the server will start with graceful startup disabled
        Returns:
        true if the server should start with graceful startup disabled
      • 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
      • 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
      • getProductConfig

        public ProductConfig getProductConfig()
        Gets the ProductConfig detected at startup.
        Returns:
        the product config. Will not be null
      • 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()
      • 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:
        Runtime.availableProcessors()