Class ReconnectionPolicy


  • public class ReconnectionPolicy
    extends Object
    A policy object that defines how a JmsConnector deals with reconnection of the local and foreign connections.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int INFINITE  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getBackOffMultiplier()
      Gets the multiplier used to grow the delay between connection attempts from the initial time to the max set time.
      long getInitialReconnectDelay()
      Gets the initial delay value used before a reconnection attempt is made.
      long getMaximumReconnectDelay()
      Gets the maximum delay that is inserted between each attempt to connect before another attempt is made.
      int getMaxInitialConnectAttempts()
      Gets the maximum number of times that the JmsConnector will try to connect on startup to before it marks itself as failed and does not try any further connections.
      int getMaxReconnectAttempts()
      Gets the number of time that JmsConnector will attempt to connect or reconnect before giving up.
      int getMaxSendRetries()
      Gets the maximum number of a times a Message send should be retried before a JMSExeception is thrown indicating that the operation failed.
      long getNextDelay​(int attempt)
      Returns the next computed delay value that the connection controller should use to wait before attempting another connection for the JmsConnector.
      long getSendRetryDelay()
      Get the amount of time the DestionationBridge will wait between attempts to forward a message.
      boolean isUseExponentialBackOff()
      Gets whether the policy uses the set back-off multiplier to grow the time between connection attempts.
      void setBackOffMultiplier​(double backOffMultiplier)
      Gets the multiplier used to grow the delay between connection attempts from the initial time to the max set time.
      void setInitialReconnectDelay​(long initialReconnectDelay)
      Gets the initial delay value used before a reconnection attempt is made.
      void setMaximumReconnectDelay​(long maximumReconnectDelay)
      Sets the maximum delay that is inserted between each attempt to connect before another attempt is made.
      void setMaxInitialConnectAttempts​(int maxAttempts)
      Sets the maximum number of times that the JmsConnector will try to connect on startup to before it marks itself as failed and does not try any further connections.
      void setMaxReconnectAttempts​(int maxReconnectAttempts)
      Sets the number of time that JmsConnector will attempt to connect or reconnect before giving up.
      void setMaxSendRetries​(int maxSendRetries)
      Sets the maximum number of a times a Message send should be retried before a JMSExeception is thrown indicating that the operation failed.
      void setSendRetyDelay​(long sendRetryDelay)
      Set the amount of time the DestionationBridge will wait between attempts to forward a message.
      void setUseExponentialBackOff​(boolean useExponentialBackOff)
      Sets whether the policy uses the set back-off multiplier to grow the time between connection attempts.
    • Constructor Detail

      • ReconnectionPolicy

        public ReconnectionPolicy()
    • Method Detail

      • getMaxSendRetries

        public int getMaxSendRetries()
        Gets the maximum number of a times a Message send should be retried before a JMSExeception is thrown indicating that the operation failed.
        Returns:
        number of send retries that will be performed.
      • setMaxSendRetries

        public void setMaxSendRetries​(int maxSendRetries)
        Sets the maximum number of a times a Message send should be retried before a JMSExeception is thrown indicating that the operation failed.
        Parameters:
        maxSendRetries - number of send retries that will be performed.
      • getSendRetryDelay

        public long getSendRetryDelay()
        Get the amount of time the DestionationBridge will wait between attempts to forward a message.
        Returns:
        time in milliseconds to wait between send attempts.
      • setSendRetyDelay

        public void setSendRetyDelay​(long sendRetryDelay)
        Set the amount of time the DestionationBridge will wait between attempts to forward a message. The default policy limits the minimum time between send attempt to one second.
        Parameters:
        sendRetryDelay - Time in milliseconds to wait before attempting another send.
      • getMaxReconnectAttempts

        public int getMaxReconnectAttempts()
        Gets the number of time that JmsConnector will attempt to connect or reconnect before giving up. By default the policy sets this value to a negative value meaning try forever.
        Returns:
        the number of attempts to connect before giving up.
      • setMaxReconnectAttempts

        public void setMaxReconnectAttempts​(int maxReconnectAttempts)
        Sets the number of time that JmsConnector will attempt to connect or reconnect before giving up. By default the policy sets this value to a negative value meaning try forever, set to a positive value to retry a fixed number of times, or zero to never try and reconnect.
        Parameters:
        maxReconnectAttempts -
      • getMaxInitialConnectAttempts

        public int getMaxInitialConnectAttempts()
        Gets the maximum number of times that the JmsConnector will try to connect on startup to before it marks itself as failed and does not try any further connections.
      • setMaxInitialConnectAttempts

        public void setMaxInitialConnectAttempts​(int maxAttempts)
        Sets the maximum number of times that the JmsConnector will try to connect on startup to before it marks itself as failed and does not try any further connections.
        Parameters:
        maxAttempts - The max number of times a connection attempt is made before failing.
      • getMaximumReconnectDelay

        public long getMaximumReconnectDelay()
        Gets the maximum delay that is inserted between each attempt to connect before another attempt is made. The default setting for this value is 30 seconds.
        Returns:
        the max delay between connection attempts in milliseconds.
      • setMaximumReconnectDelay

        public void setMaximumReconnectDelay​(long maximumReconnectDelay)
        Sets the maximum delay that is inserted between each attempt to connect before another attempt is made.
        Parameters:
        maximumReconnectDelay - The maximum delay between connection attempts in milliseconds.
      • getInitialReconnectDelay

        public long getInitialReconnectDelay()
        Gets the initial delay value used before a reconnection attempt is made. If the use exponential back-off value is set to false then this will be the fixed time between connection attempts. By default this value is set to one second.
        Returns:
        time in milliseconds that will be used between connection retries.
      • setInitialReconnectDelay

        public void setInitialReconnectDelay​(long initialReconnectDelay)
        Gets the initial delay value used before a reconnection attempt is made. If the use exponential back-off value is set to false then this will be the fixed time between connection attempts. By default this value is set to one second.
        Parameters:
        initialReconnectDelay - Time in milliseconds to wait before the first reconnection attempt.
      • isUseExponentialBackOff

        public boolean isUseExponentialBackOff()
        Gets whether the policy uses the set back-off multiplier to grow the time between connection attempts.
        Returns:
        true if the policy will grow the time between connection attempts.
      • setUseExponentialBackOff

        public void setUseExponentialBackOff​(boolean useExponentialBackOff)
        Sets whether the policy uses the set back-off multiplier to grow the time between connection attempts.
        Parameters:
        useExponentialBackOff -
      • getBackOffMultiplier

        public double getBackOffMultiplier()
        Gets the multiplier used to grow the delay between connection attempts from the initial time to the max set time. By default this value is set to 2.0.
        Returns:
        the currently configured connection delay multiplier.
      • setBackOffMultiplier

        public void setBackOffMultiplier​(double backOffMultiplier)
        Gets the multiplier used to grow the delay between connection attempts from the initial time to the max set time. By default this value is set to 2.0.
        Parameters:
        backOffMultiplier - The multiplier value used to grow the reconnection delay.
      • getNextDelay

        public long getNextDelay​(int attempt)
        Returns the next computed delay value that the connection controller should use to wait before attempting another connection for the JmsConnector.
        Parameters:
        attempt - The current connection attempt.
        Returns:
        the next delay amount in milliseconds.