Class AllowsRetriesConnection

java.lang.Object
com.adaptris.core.AdaptrisConnectionImp
com.adaptris.core.AllowsRetriesConnection
All Implemented Interfaces:
AdaptrisComponent, AdaptrisConnection, ComponentLifecycle, ComponentLifecycleExtension, StateManagedComponent
Direct Known Subclasses:
DatabaseConnection, JmsConnection, JmxConnection

public abstract class AllowsRetriesConnection extends AdaptrisConnectionImp
Abstract class for connections that have the ability to retry connections.

Generally speaking for connections that physically require initialisation such as a connection to a JMS Broker or a Database, it should be possible to configure the connection to retry the connection if it initially fails. For other types of connection such as binding on a socket, this isn't so valid.

Previously AdaptrisConnectionImp exposed connectionAttemps and connectionWait however, this class was introduced reduce the number of un-used fields in the connection hierarchy.

See Also:
  • Constructor Details

    • AllowsRetriesConnection

      public AllowsRetriesConnection()
      Default Constructor with the following default values.
      • connectionAttempts is -1
      • setConnectionWait is 60000
  • Method Details

    • setConnectionAttempts

      public void setConnectionAttempts(Integer i)

      Sets the number of connection attempts to make. -1 means keep trying indefinitely.

      Parameters:
      i - the number of connection attempts to make
    • getConnectionAttempts

      public Integer getConnectionAttempts()

      Returns the number of connection attempts to make.

      Returns:
      the number of connection attempts to make
    • connectionAttempts

      public int connectionAttempts()
    • connectionRetryInterval

      public long connectionRetryInterval()
      Returns the wait between connection attempts in milliseconds.
      Returns:
      the connection retry interval in ms.
    • logWarning

      protected boolean logWarning(int attemptCount)
    • createLoggingStatement

      protected String createLoggingStatement(int attempt)
    • getConnectionRetryInterval

      public TimeInterval getConnectionRetryInterval()
    • setConnectionRetryInterval

      public void setConnectionRetryInterval(TimeInterval interval)
      Set the interval between each retry attempt.
      Parameters:
      interval - the interval between each retry attempt.