Class AppCluster


  • public class AppCluster
    extends Object
    Central AppCluster manager.
    Author:
    AO Industries, Inc.
    • Constructor Detail

      • AppCluster

        public AppCluster​(AppClusterConfiguration configuration)
        Creates a cluster with the provided configuration. The cluster is not started until start is called.
        See Also:
        start()
      • AppCluster

        public AppCluster​(File file)
        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 until start is called.
        See Also:
        start()
      • AppCluster

        public AppCluster​(Properties properties)
        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 until start is called.
        See Also:
        start()
    • Method Detail

      • addResourceListener

        public void addResourceListener​(ResourceListener resourceListener)
        Will be called when the resource result has changed in any way.
      • removeResourceListener

        public void removeResourceListener​(ResourceListener resourceListener)
        Removes listener of resource result changes.
      • isRunning

        public boolean isRunning()
        Checks if this cluster is running.
        See Also:
        start(), stop()
      • getStartedTime

        public UnmodifiableTimestamp getStartedTime()
        Gets the time this cluster was started or null if not running.
      • stop

        public void stop()
        Stops this cluster manager.
        See Also:
        start()
      • isEnabled

        public boolean isEnabled()
        If the cluster is disabled, every node and resource will also be disabled. A stopped cluster is considered disabled.
      • getDisplay

        public String getDisplay()
        Gets the display name for this cluster or null if not started.
      • getNodes

        public Set<? extends Node> getNodes()
        Gets the set of all nodes or empty set if not started.
      • getNode

        public Node getNode​(String id)
        Gets a node given its ID or null if not found.
      • getNodeMap

        public Map<String,​Node> 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

        public Name getLocalHostname()
        Gets the hostname used to determine which node this server represents or null if not started.
      • getLocalUsername

        public String getLocalUsername()
        Gets the username used to determine which node this server represents or null if not started.
      • getLocalNode

        public Node getLocalNode()
        Gets the node this machine represents or null 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

        public Set<? extends Resource<?,​?>> getResources()
        Gets the set of all resources or empty set if not started.
      • getResourceMap

        public Map<String,​? extends Resource<?,​?>> 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

        public EnumSet<ResourceStatus> getStatuses()
        Gets all of the possible statuses for this cluster. This is primarily for JavaBeans property from JSP EL.
      • getStatus

        public ResourceStatus getStatus()
        Gets the overall status of the cluster based on started, enabled, and all resources.