java.lang.Object
com.aoapps.appcluster.AppCluster
Central AppCluster manager.
- Author:
- AO Industries, Inc.
-
Constructor Summary
ConstructorDescriptionAppCluster
(AppClusterConfiguration configuration) Creates a cluster with the provided configuration.AppCluster
(File file) Creates a cluster loading configuration from the provided properties file.AppCluster
(Properties properties) Creates a cluster configurated from the provided properties file. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addResourceListener
(ResourceListener resourceListener) Will be called when the resource result has changed in any way.static void
checkConfiguration
(Set<? extends NodeConfiguration> nodeConfigurations, Set<? extends ResourceConfiguration<?, ?>> resourceConfigurations) Performs a consistency check on a configuration.Gets the display name for this cluster ornull
if not started.Gets the hostname used to determine which node this server represents ornull
if not started.Gets the node this machine represents ornull
if this machine is not one of the nodes.Gets the username used to determine which node this server represents ornull
if not started.Gets a node given its ID ornull
if not found.Gets a map view of the nodes, keyed by their id.getNodes()
Gets the set of all nodes or empty set if not started.Gets a map view of the resources keyed on String resourceId.Gets the set of all resources or empty set if not started.Gets the time this cluster was started ornull
if not running.Gets the overall status of the cluster based on started, enabled, and all resources.Gets all of the possible statuses for this cluster.boolean
If the cluster is disabled, every node and resource will also be disabled.boolean
Checks if this cluster is running.void
removeResourceListener
(ResourceListener resourceListener) Removes listener of resource result changes.void
start()
Starts this cluster manager.void
stop()
Stops this cluster manager.toString()
-
Constructor Details
-
AppCluster
Creates a cluster with the provided configuration. The cluster is not started untilstart
is called.- See Also:
-
AppCluster
Creates a cluster loading configuration from the provided properties file. Any change to the file will cause an automatic reload of the cluster configuration. The cluster is not started untilstart
is called.- See Also:
-
AppCluster
Creates a cluster configurated from the provided properties file. Changes to the properties file will not result in a cluster configuration. The cluster is not started untilstart
is called.- See Also:
-
-
Method Details
-
checkConfiguration
public static void checkConfiguration(Set<? extends NodeConfiguration> nodeConfigurations, Set<? extends ResourceConfiguration<?, ?>> resourceConfigurations) throws AppClusterConfigurationExceptionPerforms a consistency check on a configuration.- Throws:
AppClusterConfigurationException
-
addResourceListener
Will be called when the resource result has changed in any way. -
removeResourceListener
Removes listener of resource result changes. -
isRunning
public boolean isRunning()Checks if this cluster is running.- See Also:
-
getStartedTime
Gets the time this cluster was started ornull
if not running. -
start
Starts this cluster manager.- Throws:
AppClusterConfigurationException
- See Also:
-
stop
public void stop()Stops this cluster manager.- See Also:
-
isEnabled
public boolean isEnabled()If the cluster is disabled, every node and resource will also be disabled. A stopped cluster is considered disabled. -
getDisplay
Gets the display name for this cluster ornull
if not started. -
toString
-
getNodes
Gets the set of all nodes or empty set if not started. -
getNode
Gets a node given its ID ornull
if not found. -
getNodeMap
Gets a map view of the nodes, keyed by their id. This is not a fast implementation and is here for JSP EL compatibility. -
getLocalHostname
Gets the hostname used to determine which node this server represents ornull
if not started. -
getLocalUsername
Gets the username used to determine which node this server represents ornull
if not started. -
getLocalNode
Gets the node this machine represents ornull
if this machine is not one of the nodes. For this JVM to be considered the local node, the system hostname must match this node's hostname, and the system property "user.name" must match this node's username.Determined at cluster start time, before any resources are started.
Returns
null
when not started. -
getResources
Gets the set of all resources or empty set if not started. -
getResourceMap
Gets a map view of the resources keyed on String resourceId. This is for compatibility with JSP EL - it is not a fast implementation. -
getStatuses
Gets all of the possible statuses for this cluster. This is primarily for JavaBeans property from JSP EL. -
getStatus
Gets the overall status of the cluster based on started, enabled, and all resources.
-