Class EndpointManager


  • public final class EndpointManager
    extends java.lang.Object
    The EndpointManager is responsible for maintaining connection timeout and connection retry information for endpoints. It may be used by multiple Connector objects to ensure that failing endpoints are not repeatedly connected to or waited on.
    Author:
    Kevin Roast
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean allowConnect​(java.lang.String endpoint)
      Returns true if the connector should make a connection attempt to the specified endpoint, false if the endpoint is still in the "wait" period between retries.
      static boolean processResponseCode​(java.lang.String endpoint, int code)
      Process the given response code for an endpoint - recording if that remote connection is unavailable for a time.
      static void registerEndpoint​(java.lang.String endpoint)
      Register an endpoint with the manager - the same endpoint can be registered any number of times by multiple threads without side effects.
      static void registerEndpoint​(java.lang.String endpoint, RemoteConfigElement.ConnectorDescriptor descriptor)
      Register an endpoint with the manager - the same endpoint can be registered any number of times by multiple threads without side effects.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • registerEndpoint

        public static void registerEndpoint​(java.lang.String endpoint)
        Register an endpoint with the manager - the same endpoint can be registered any number of times by multiple threads without side effects.
        Parameters:
        endpoint - The endpoint to register
      • registerEndpoint

        public static void registerEndpoint​(java.lang.String endpoint,
                                            RemoteConfigElement.ConnectorDescriptor descriptor)
        Register an endpoint with the manager - the same endpoint can be registered any number of times by multiple threads without side effects.
        Parameters:
        endpoint - The endpoint to register
        descriptor - The ConnectorDescriptor used to connect to this endpoint Used to retrieve reconnection timeout config.
      • allowConnect

        public static boolean allowConnect​(java.lang.String endpoint)
        Returns true if the connector should make a connection attempt to the specified endpoint, false if the endpoint is still in the "wait" period between retries.
        Parameters:
        endpoint - The endpoint to test
        Returns:
        true to allow connect, false otherwise
      • processResponseCode

        public static boolean processResponseCode​(java.lang.String endpoint,
                                                  int code)
        Process the given response code for an endpoint - recording if that remote connection is unavailable for a time. Returns true if further response processing should continue, false otherwise.
        Parameters:
        endpoint - The endpoint to record code against
        code - Response code
        Returns:
        true if further processing should continue, false otherwise