public abstract class AllowsRetriesConnection extends AdaptrisConnectionImp
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.
JmsConnection
,
DatabaseConnection
log
Constructor and Description |
---|
AllowsRetriesConnection()
Default Constructor with the following default values.
|
Modifier and Type | Method and Description |
---|---|
int |
connectionAttempts() |
long |
connectionRetryInterval()
Returns the wait between connection attempts in milliseconds.
|
protected java.lang.String |
createLoggingStatement(int attempt) |
java.lang.Integer |
getConnectionAttempts()
Returns the number of connection attempts to make.
|
TimeInterval |
getConnectionRetryInterval() |
protected boolean |
logWarning(int attemptCount) |
void |
setConnectionAttempts(java.lang.Integer i)
Sets the number of connection attempts to make.
|
void |
setConnectionRetryInterval(TimeInterval interval)
Set the interval between each retry attempt.
|
addExceptionListener, addMessageConsumer, addMessageProducer, changeState, cloneForTesting, close, closeConnection, connectionErrorHandler, getConnectionErrorHandler, getLookupName, getUniqueId, getWorkersFirstOnShutdown, init, initConnection, prepare, prepareConnection, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveConnection, retrieveExceptionListeners, retrieveMessageConsumers, retrieveMessageProducers, setConnectionErrorHandler, setLookupName, setUniqueId, setWorkersFirstOnShutdown, start, startConnection, stop, stopConnection, workersFirstOnShutdown
public AllowsRetriesConnection()
public void setConnectionAttempts(java.lang.Integer i)
Sets the number of connection attempts to make. -1 means keep trying indefinitely.
i
- the number of connection attempts to makepublic java.lang.Integer getConnectionAttempts()
Returns the number of connection attempts to make.
public int connectionAttempts()
public long connectionRetryInterval()
protected boolean logWarning(int attemptCount)
protected java.lang.String createLoggingStatement(int attempt)
public TimeInterval getConnectionRetryInterval()
public void setConnectionRetryInterval(TimeInterval interval)
interval
- the interval between each retry attempt.