Interface MCMPHandler

All Known Implementing Classes:
DefaultMCMPHandler

public interface MCMPHandler
Handles communication via MCMP with the reverse proxy side.
Author:
Brian Stansberry
  • Method Details

    • init

      void init(Collection<ProxyConfiguration> initialProxies, MCMPConnectionListener connectionListener)
      Initialization method for MCMP handler.
      Parameters:
      initialProxies - a collection of initial ProxyConfigurations
      connectionListener - connection listener
    • shutdown

      void shutdown()
      Perform any shut down work.
    • sendRequest

      Map<MCMPServerState,String> sendRequest(MCMPRequest request)
      Send a request to all healthy proxies.
      Parameters:
      request - the request. Cannot be null
    • sendRequests

      Map<MCMPServerState,List<String>> sendRequests(List<MCMPRequest> requests)
      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.
      Parameters:
      requests - the requests. Cannot be null
    • addProxy

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

      Same as addProxy(address, false.

      Parameters:
      socketAddress - InetSocketAddress on which the proxy listens for MCMP requests
    • addProxy

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

      Same as addProxy(proxyConfiguration, false).

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

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

      void addProxy(ProxyConfiguration proxyConfiguration, boolean established)
      Add a proxy to the list of those with which this handler communicates. Communication does not begin until the next call to status().
      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

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

      Set<MCMPServerState> getProxyStates()
      Get the state of all proxies
      Returns:
      a set of status objects indicating the status of this handler's communication with all proxies.
    • reset

      void reset()
      Reset any proxies whose status is DOWN up to ERROR, where the configuration will be refreshed.
    • markProxiesInError

      void markProxiesInError()
      Reset any proxies whose status is OK down to ERROR, which will trigger a refresh of their configuration.
    • isProxyHealthOK

      boolean isProxyHealthOK()
      Convenience method that checks whether the status of all proxies is OK.
      Returns:
      true if all proxies are OK, false otherwise
    • status

      void status()
      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.