Class MultiServerClusterMonitor

  • All Implemented Interfaces:
    ClusterMonitor

    public class MultiServerClusterMonitor
    extends Object
    implements ClusterMonitor
    API for querying status of servers in cluster. Extracted from SessionService class as part of first-pass refactoring to improve SessionService adherence to SRP.
    Since:
    13.0.0
    • Constructor Detail

      • MultiServerClusterMonitor

        public MultiServerClusterMonitor​(Debug sessionDebug,
                                         SessionServiceConfig serviceConfig,
                                         SessionServerConfig serverConfig)
                                  throws Exception
        Parameters:
        sessionDebug - The session debug instance.
        serviceConfig - The configuration for the session service.
        serverConfig - The configuration for the session server.
        Throws:
        Exception
    • Method Detail

      • isSiteUp

        public boolean isSiteUp​(String siteId)
        Indicates if the specified site is up.
        Specified by:
        isSiteUp in interface ClusterMonitor
        Parameters:
        siteId - A possibly null Site Id.
        Returns:
        True if the Site is up, False if it failed to respond to a query.
      • checkServerUp

        public boolean checkServerUp​(String serverID)
        Indicates if the specified server is up.
        Specified by:
        checkServerUp in interface ClusterMonitor
        Parameters:
        serverID - server id
        Returns:
        true if server is up, false otherwise
      • getCurrentHostServer

        public String getCurrentHostServer​(SessionID sid)
                                    throws SessionException
        Identify the host (aka home or authoritative) server for the provided session. If the currently assigned host server for the session is found to be down, this method uses a deterministic algorithm to select a new one from those known to the clustering servive based on the session's STORAGE_KEY. This is the key method of "internal request routing".
        Specified by:
        getCurrentHostServer in interface ClusterMonitor
        Parameters:
        sid - SessionID for which the home server is to be found
        Returns:
        server id for the server instance determined to be the current host
        Throws:
        SessionException
      • shutdown

        public void shutdown()
        Signals that this ClusterMonitor should be shutdown. Will signal the underlying ClusterStateService to cancel its runnable thread. Thread Safety: Synchronized to prevent possible multiple calls which would break state in the underlying GeneralRunnableTask framework.
        Specified by:
        shutdown in interface ClusterMonitor