Class RetryStrategy
java.lang.Object
com.pushtechnology.diffusion.client.session.retry.RetryStrategy
Defines a retry strategy.
A retry strategy will be applied when an initial to attempt to open a session
fails with a SessionEstablishmentTransientException
.
A retry strategy will be applied when recovering by a
RecoverableUpdateStream
following a recoverable exception.
The strategy is defined in terms of the number of milliseconds between retries and the maximum number of retries to attempt.
- Since:
- 6.9
- Author:
- DiffusionData Limited
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RetryStrategy
The retry strategy that indicates that no retry is to be attempted. -
Constructor Summary
ConstructorsConstructorDescriptionRetryStrategy
(long interval) Creates a new retry strategy that will retry indefinitely at the specified interval.RetryStrategy
(long interval, int attempts) Creates a new retry strategy object. -
Method Summary
-
Field Details
-
NO_RETRY
The retry strategy that indicates that no retry is to be attempted.
-
-
Constructor Details
-
RetryStrategy
public RetryStrategy(long interval, int attempts) Creates a new retry strategy object.- Parameters:
interval
- the number of milliseconds before the first retry and between subsequent retriesattempts
- the number of retry attempts
-
RetryStrategy
public RetryStrategy(long interval) Creates a new retry strategy that will retry indefinitely at the specified interval.- Parameters:
interval
- the number of milliseconds before the first retry and between subsequent retries
-
-
Method Details
-
getInterval
public long getInterval()Returns the time interval between attempts.- Returns:
- the interval in ms.
-
getAttempts
public int getAttempts()Returns the number of retry attempts.- Returns:
- the number of retry attempts, where
Integer.MAX_VALUE
means infinite retries.
-
hashCode
public int hashCode() -
equals
-
toString
-