Class BinaryExceptionClassifierRetryPolicy

java.lang.Object
org.springframework.retry.policy.BinaryExceptionClassifierRetryPolicy
All Implemented Interfaces:
Serializable, RetryPolicy

public class BinaryExceptionClassifierRetryPolicy extends Object implements RetryPolicy
A policy, that is based on BinaryExceptionClassifier. Usually, binary classification is enough for retry purposes. If you need more flexible classification, use ExceptionClassifierRetryPolicy.
Author:
Aleksandr Shamukov
See Also:
  • Constructor Details

    • BinaryExceptionClassifierRetryPolicy

      public BinaryExceptionClassifierRetryPolicy(BinaryExceptionClassifier exceptionClassifier)
  • Method Details

    • getExceptionClassifier

      public BinaryExceptionClassifier getExceptionClassifier()
    • canRetry

      public boolean canRetry(RetryContext context)
      Specified by:
      canRetry in interface RetryPolicy
      Parameters:
      context - the current retry status
      Returns:
      true if the operation can proceed
    • close

      public void close(RetryContext status)
      Specified by:
      close in interface RetryPolicy
      Parameters:
      status - a retry status created by the RetryPolicy.open(RetryContext) method of this policy.
    • registerThrowable

      public void registerThrowable(RetryContext context, Throwable throwable)
      Description copied from interface: RetryPolicy
      Called once per retry attempt, after the callback fails.
      Specified by:
      registerThrowable in interface RetryPolicy
      Parameters:
      context - the current status object.
      throwable - the exception to throw
    • open

      public RetryContext open(RetryContext parent)
      Description copied from interface: RetryPolicy
      Acquire resources needed for the retry operation. The callback is passed in so that marker interfaces can be used and a manager can collaborate with the callback to set up some state in the status token.
      Specified by:
      open in interface RetryPolicy
      Parameters:
      parent - the parent context if we are in a nested retry.
      Returns:
      a RetryContext object specific to this policy.