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>

public class DefaultExpiryPolicy<T> extends Object implements 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 Details

    • DefaultExpiryPolicy

      public DefaultExpiryPolicy()
  • Method Details

    • computeExpiry

      public Instant computeExpiry(Failover failover)
      Description copied from interface: ExpiryPolicy
      Computes the expiry instant for a payload stored under the given failover.
      Specified by:
      computeExpiry in interface ExpiryPolicy<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

      public boolean isExpired(Failover failover, ReferentialPayload<T> referentialPayload)
      Description copied from interface: ExpiryPolicy
      Returns true if the stored payload has expired.
      Specified by:
      isExpired in interface ExpiryPolicy<T>
      Parameters:
      failover - annotation metadata for the failover point
      referentialPayload - the stored payload to check
      Returns:
      true if the payload's expiry time is in the past