Class AdvancedFailoverHandler<T>

java.lang.Object
com.societegenerale.failover.core.AdvancedFailoverHandler<T>
Type Parameters:
T - the type of the payload managed by this handler
All Implemented Interfaces:
FailoverHandler<T>

public class AdvancedFailoverHandler<T> extends Object implements FailoverHandler<T>
FailoverHandler decorator that publishes metrics on every store/recover operation and delegates payload post-processing to a RecoveredPayloadHandler.
Author:
Anand Manissery
  • Constructor Details

    • AdvancedFailoverHandler

      public AdvancedFailoverHandler()
  • Method Details

    • store

      public T store(Failover failover, List<Object> args, T payload)
      Description copied from interface: FailoverHandler
      Stores the payload for later recovery.
      Specified by:
      store in interface FailoverHandler<T>
      Parameters:
      failover - annotation metadata for the failover point
      args - method arguments used to derive the store key
      payload - the result to store
      Returns:
      the stored payload
    • recover

      public T recover(Failover failover, List<Object> args, Class<T> clazz, Throwable cause)
      Description copied from interface: FailoverHandler
      Recovers a previously stored payload after a failure.
      Specified by:
      recover in interface FailoverHandler<T>
      Parameters:
      failover - annotation metadata for the failover point
      args - method arguments used to derive the lookup key
      clazz - expected return type
      cause - the exception that triggered recovery
      Returns:
      the recovered payload, or null if not found or expired
    • recoverAll

      public List<T> recoverAll(Failover failover, List<Object> args, Class<T> clazz, Throwable cause)
      Specified by:
      recoverAll in interface FailoverHandler<T>
    • clean

      public void clean()
      Description copied from interface: FailoverHandler
      Removes all expired entries from the failover store.
      Specified by:
      clean in interface FailoverHandler<T>