Class DefaultExpiryPolicy<T>
java.lang.Object
com.societegenerale.failover.core.expiry.DefaultExpiryPolicy<T>
- Type Parameters:
T- the payload type whose expiry this policy governs
- All Implemented Interfaces:
ExpiryPolicy<T>
Default
ExpiryPolicy that computes expiry by adding the annotation-configured duration
to the current clock time, and checks expiry against the current clock.- Author:
- Anand Manissery
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncomputeExpiry(Failover failover) Computes the expiry instant for a payload stored under the given failover.booleanisExpired(Failover failover, ReferentialPayload<T> referentialPayload) Returnstrueif the stored payload has expired.
-
Constructor Details
-
DefaultExpiryPolicy
public DefaultExpiryPolicy()
-
-
Method Details
-
computeExpiry
Description copied from interface:ExpiryPolicyComputes the expiry instant for a payload stored under the given failover.- Specified by:
computeExpiryin interfaceExpiryPolicy<T>- Parameters:
failover- annotation metadata containing the configured expiry duration and unit- Returns:
- the absolute instant after which the stored payload should be considered expired
-
isExpired
Description copied from interface:ExpiryPolicyReturnstrueif the stored payload has expired.- Specified by:
isExpiredin interfaceExpiryPolicy<T>- Parameters:
failover- annotation metadata for the failover pointreferentialPayload- the stored payload to check- Returns:
trueif the payload's expiry time is in the past
-