Package org.ldaptive
Class AbstractRetryMetadata
- java.lang.Object
-
- org.ldaptive.AbstractRetryMetadata
-
- All Implemented Interfaces:
RetryMetadata
- Direct Known Subclasses:
ClosedRetryMetadata,InitialRetryMetadata,LdapURLRetryMetadata
public abstract class AbstractRetryMetadata extends Object implements RetryMetadata
Common implementation of retry metadata.
-
-
Field Summary
Fields Modifier and Type Field Description private AtomicIntegerattemptsAttempt count.private InstantcreateTimeTime at which this metadata was created.protected InstantfailureTimeTime at which the failure occurred.protected InstantsuccessTimeTime at which the last success occurred.
-
Constructor Summary
Constructors Modifier Constructor Description AbstractRetryMetadata()Creates a new abstract retry metadata.protectedAbstractRetryMetadata(Clock clock)Creates a new abstract retry metadata.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetAttempts()Number of attempts for this retry.InstantgetCreateTime()Returns the create time.InstantgetFailureTime()Returns the failure time.InstantgetSuccessTime()Returns the success time.voidrecordFailure(Instant time)Records a connection failure at the given instant.voidrecordSuccess(Instant time)Records a connection success at the given instant.StringtoString()
-
-
-
Field Detail
-
successTime
protected Instant successTime
Time at which the last success occurred.
-
failureTime
protected Instant failureTime
Time at which the failure occurred.
-
createTime
private final Instant createTime
Time at which this metadata was created.
-
attempts
private final AtomicInteger attempts
Attempt count.
-
-
Constructor Detail
-
AbstractRetryMetadata
public AbstractRetryMetadata()
Creates a new abstract retry metadata.
-
AbstractRetryMetadata
protected AbstractRetryMetadata(Clock clock)
Creates a new abstract retry metadata.- Parameters:
clock- to set the create time
-
-
Method Detail
-
getSuccessTime
public Instant getSuccessTime()
Description copied from interface:RetryMetadataReturns the success time.- Specified by:
getSuccessTimein interfaceRetryMetadata- Returns:
- time that the success occurred
-
getFailureTime
public Instant getFailureTime()
Description copied from interface:RetryMetadataReturns the failure time.- Specified by:
getFailureTimein interfaceRetryMetadata- Returns:
- time that the failure occurred
-
getCreateTime
public Instant getCreateTime()
Description copied from interface:RetryMetadataReturns the create time.- Specified by:
getCreateTimein interfaceRetryMetadata- Returns:
- time that the metadata was created
-
getAttempts
public int getAttempts()
Description copied from interface:RetryMetadataNumber of attempts for this retry.- Specified by:
getAttemptsin interfaceRetryMetadata- Returns:
- retry attempts
-
recordSuccess
public void recordSuccess(Instant time)
Description copied from interface:RetryMetadataRecords a connection success at the given instant.- Specified by:
recordSuccessin interfaceRetryMetadata- Parameters:
time- Point in time when connection was opened.
-
recordFailure
public void recordFailure(Instant time)
Description copied from interface:RetryMetadataRecords a connection failure at the given instant.- Specified by:
recordFailurein interfaceRetryMetadata- Parameters:
time- Point in time when connection failed.
-
-