Class ClusterSupport

java.lang.Object
com.groiss.cluster.ClusterSupport

public class ClusterSupport extends Object
Cluster support functions accessible via HTTP requests.
  • Method Details

    • getNodeState

      @EntryPoint public static void getNodeState(HttpServletRequest req, HttpServletResponse res)
      Gets the state of the current node suitable for health checks (e.g. via HAProxy).
      Parameters:
      req - the request
      res - the response with one of the following states:
    • unbind

      @EntryPoint public void unbind(HttpServletRequest req, HttpServletResponse res) throws Exception
      Change the node.

      Used in deployment scenarios behind a reverse proxy / loadbalancer.

      Removes the current node routing cookie from the client and redirects it to the least loaded node.

      Parameters:
      req - the request
      res - the response; consists of an immediately expiring node cookie and calls document.location.replace with redirect(HttpServletRequest, HttpServletResponse)
      Throws:
      Exception
    • getClientInfo

      @EntryPoint public static HTMLPage getClientInfo(HttpServletRequest req)
      Shows information about the request and the session.
      Parameters:
      req - the request
      Returns:
      a Page containing information about
      • the components of the request URL
      • the remote address
      • the node id
      • the headers of the request
      • the cookies in the request
      • the parameters of the request
      • the attributes of the request
      • the session info
      • attributes of the session
    • redirect

      @EntryPoint public static void redirect(HttpServletRequest req, HttpServletResponse res) throws Exception
      Redirects the client to the node which has the least workload based on the number of connected users and the performance factor of the node.

      Used in deployment scenarios without a dedicated reverse proxy / loadbalancer.

      Parameters:
      req - the request; can have a parameter nodeid, then the redirect target is the specified node, irrespective of the current load
      res - the response; an HTML page which executes a "document.location.replace" call.
      Throws:
      Exception
    • getRedirectAddresses

      @EntryPoint public void getRedirectAddresses(HttpServletRequest req, HttpServletResponse res) throws Exception
      Determines the node which has the least workload based on the number of connected users and the performance factor of the node. Sends back the URLs for RMI, HTTP and HTTPS for that node.

      Used in deployment scenarios without a dedicated reverse proxy / loadbalancer.

      Parameters:
      req - the request
      res - the response; a text/plain page which consists of three lines denoting the RMI address, the HTTP address and the HTTPS address of the node
      Throws:
      Exception
    • getAllRedirectAddresses

      @EntryPoint public void getAllRedirectAddresses(HttpServletRequest req, HttpServletResponse res) throws Exception
      Returns a list of addresses where logins may be performed.

      For each node that is considered to be alive, three URLs (RMI, HTTP and HTTPS) are returned. The nodes are sorted by their load; the least loaded node is the first one.

      Used in deployment scenarios without a dedicated reverse proxy / loadbalancer.

      Parameters:
      req - the request; if it contains the parameter localaddress, just the address of the current node will be returned
      res - the response; a text/plain page which for each node consists of three lines denoting the RMI address, the HTTP address and the HTTPS address
      Throws:
      Exception
    • getHazelcastState

      @EntryPoint public static void getHazelcastState(HttpServletRequest req, HttpServletResponse res) throws Exception
      Displays details about the state of the Hazelcast subsystem.

      The "view configuration" right is needed to call this function.

      Parameters:
      req - the request accepts the following parameters:
      • showDetails=true also displays details of all keys and their placement in partitions;
      • showConfig=true also displays the Hazelcast configuration
      res - the response, a text/plain status summary
      Throws:
      Exception
    • getHazelcastSessionInfo

      @EntryPoint public static void getHazelcastSessionInfo(HttpServletRequest req, HttpServletResponse res) throws Exception
      Displays details about a session in the Hazelcast subsystem.

      The "view configuration" right is needed to call this function.

      Parameters:
      req - the request; if parameter sessionid=<sessionid> is given, the specified session is displayed; if the parameter is missing, the current session is displayed
      res - a text/plain session status summary
      Throws:
      Exception