Class RecoveryStrategy

java.lang.Object
com.symphony.bdk.core.retry.RecoveryStrategy

@API(status=INTERNAL) public class RecoveryStrategy extends Object
Class used by RetryWithRecovery to store a recovery strategy, i.e. a condition on the exception to check whether the recovery function must be executed and a recovery function to be executed.
  • Constructor Details

    • RecoveryStrategy

      public RecoveryStrategy(Class<? extends T> exceptionType, Predicate<T> condition, ConsumerWithThrowable recovery)
      Type Parameters:
      T - the actual exception class
      Parameters:
      exceptionType - the actual exception class
      condition - the predicate which checks if a given exception corresponds to the recovery strategy
      recovery - the recovery function to be executed when applicable
  • Method Details

    • matches

      public boolean matches(Exception e)
      Function to test if an exception corresponds to the recovery strategy.
      Parameters:
      e - the exception to be tested
      Returns:
      true if the provided exception corresponds to the recovery strategy
    • runRecovery

      public void runRecovery() throws Throwable
      Runs the recovery function.
      Throws:
      Throwable - can be thrown by ConsumerWithThrowable.consume()