Class DefaultMCMPHandler

java.lang.Object
org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler
All Implemented Interfaces:
MCMPHandler

@ThreadSafe public class DefaultMCMPHandler extends Object implements MCMPHandler
Default implementation of MCMPHandler.
Author:
Jean-Frederic Clere, Brian Stansberry, Paul Ferraro
  • Constructor Details

  • Method Details

    • init

      public void init(Collection<ProxyConfiguration> proxies, MCMPConnectionListener connectionListener)
      Description copied from interface: MCMPHandler
      Initialization method for MCMP handler.
      Specified by:
      init in interface MCMPHandler
      Parameters:
      proxies - a collection of initial ProxyConfigurations
      connectionListener - connection listener
    • shutdown

      public void shutdown()
      Description copied from interface: MCMPHandler
      Perform any shut down work.
      Specified by:
      shutdown in interface MCMPHandler
    • addProxy

      @Deprecated public void addProxy(InetSocketAddress socketAddress)
      Deprecated.
      Description copied from interface: MCMPHandler
      Add a proxy to the list of those with which this handler communicates. Communication does not begin until the next call to MCMPHandler.status().

      Same as addProxy(address, false.

      Specified by:
      addProxy in interface MCMPHandler
      Parameters:
      socketAddress - InetSocketAddress on which the proxy listens for MCMP requests
    • addProxy

      public void addProxy(ProxyConfiguration proxyConfiguration)
      Description copied from interface: MCMPHandler
      Add a proxy to the list of those with which this handler communicates. Communication does not begin until the next call to MCMPHandler.status().

      Same as addProxy(proxyConfiguration, false).

      Specified by:
      addProxy in interface MCMPHandler
      Parameters:
      proxyConfiguration - ProxyConfiguration defining address on which the proxy listens for MCMP requests and optional local address to bind connections to
    • addProxy

      @Deprecated public void addProxy(InetSocketAddress socketAddress, boolean established)
      Deprecated.
      Description copied from interface: MCMPHandler
      Add a proxy to the list of those with which this handler communicates. Communication does not begin until the next call to MCMPHandler.status().
      Specified by:
      addProxy in interface MCMPHandler
      Parameters:
      socketAddress - InetSocketAddress on which the proxy listens for MCMP requests
      established - true if the proxy should be considered established, false otherwise.
    • addProxy

      public void addProxy(ProxyConfiguration proxyConfiguration, boolean established)
      Description copied from interface: MCMPHandler
      Add a proxy to the list of those with which this handler communicates. Communication does not begin until the next call to MCMPHandler.status().
      Specified by:
      addProxy in interface MCMPHandler
      Parameters:
      proxyConfiguration - ProxyConfiguration defining address on which the proxy listens for MCMP requests and optional local address to bind connections to
      established - true if the proxy should be considered established, false otherwise.
    • removeProxy

      public void removeProxy(InetSocketAddress socketAddress)
      Description copied from interface: MCMPHandler
      Remove a proxy from the list of those with which this handler communicates. Communication does not end until the next call to MCMPHandler.status().
      Specified by:
      removeProxy in interface MCMPHandler
      Parameters:
      socketAddress - InetSocketAddress on which the proxy listens for MCMP requests
    • getProxyStates

      public Set<MCMPServerState> getProxyStates()
      Description copied from interface: MCMPHandler
      Get the state of all proxies
      Specified by:
      getProxyStates in interface MCMPHandler
      Returns:
      a set of status objects indicating the status of this handler's communication with all proxies.
    • isProxyHealthOK

      public boolean isProxyHealthOK()
      Description copied from interface: MCMPHandler
      Convenience method that checks whether the status of all proxies is OK.
      Specified by:
      isProxyHealthOK in interface MCMPHandler
      Returns:
      true if all proxies are OK, false otherwise
    • markProxiesInError

      public void markProxiesInError()
      Description copied from interface: MCMPHandler
      Reset any proxies whose status is OK down to ERROR, which will trigger a refresh of their configuration.
      Specified by:
      markProxiesInError in interface MCMPHandler
    • reset

      public void reset()
      Description copied from interface: MCMPHandler
      Reset any proxies whose status is DOWN up to ERROR, where the configuration will be refreshed.
      Specified by:
      reset in interface MCMPHandler
    • status

      public void status()
      Description copied from interface: MCMPHandler
      Perform periodic processing. Update the list of proxies to reflect any calls to addProxy(...) or removeProxy(...). Attempt to establish communication with any proxies whose state is ERROR. If successful and a ResetRequestSource has been provided, update the proxy with the list of requests provided by the source.
      Specified by:
      status in interface MCMPHandler
    • sendRequest

      public Map<MCMPServerState,String> sendRequest(MCMPRequest request)
      Description copied from interface: MCMPHandler
      Send a request to all healthy proxies.
      Specified by:
      sendRequest in interface MCMPHandler
      Parameters:
      request - the request. Cannot be null
    • sendRequests

      public Map<MCMPServerState,List<String>> sendRequests(List<MCMPRequest> requests)
      Description copied from interface: MCMPHandler
      Send a list of requests to all healthy proxies, with all requests in the list sent to each proxy before moving on to the next.
      Specified by:
      sendRequests in interface MCMPHandler
      Parameters:
      requests - the requests. Cannot be null