类 CircuitBreakerRetryPolicy

java.lang.Object
infra.retry.policy.CircuitBreakerRetryPolicy
所有已实现的接口:
RetryPolicy, Serializable

public class CircuitBreakerRetryPolicy extends Object implements RetryPolicy
从以下版本开始:
4.0
作者:
Dave Syer, Harry Yang
另请参阅:
  • 字段详细资料

    • log

      private static final infra.logging.Logger log
    • CIRCUIT_OPEN

      public static final String CIRCUIT_OPEN
      另请参阅:
    • CIRCUIT_SHORT_COUNT

      public static final String CIRCUIT_SHORT_COUNT
      另请参阅:
    • delegate

      private final RetryPolicy delegate
    • resetTimeout

      private long resetTimeout
    • openTimeout

      private long openTimeout
    • resetTimeoutSupplier

      private Supplier<Long> resetTimeoutSupplier
    • openTimeoutSupplier

      private Supplier<Long> openTimeoutSupplier
  • 构造器详细资料

    • CircuitBreakerRetryPolicy

      public CircuitBreakerRetryPolicy()
    • CircuitBreakerRetryPolicy

      public CircuitBreakerRetryPolicy(RetryPolicy delegate)
  • 方法详细资料

    • setResetTimeout

      public void setResetTimeout(long timeout)
      Timeout for resetting circuit in milliseconds. After the circuit opens it will re-close after this time has elapsed and the context will be restarted.
      参数:
      timeout - the timeout to set in milliseconds
    • resetTimeoutSupplier

      public void resetTimeoutSupplier(Supplier<Long> timeoutSupplier)
      A supplier for the timeout for resetting circuit in milliseconds. After the circuit opens it will re-close after this time has elapsed and the context will be restarted.
      参数:
      timeoutSupplier - a supplier for the timeout to set in milliseconds
    • setOpenTimeout

      public void setOpenTimeout(long timeout)
      Timeout for tripping the open circuit. If the delegate policy cannot retry and the time elapsed since the context was started is less than this window, then the circuit is opened.
      参数:
      timeout - the timeout to set in milliseconds
    • openTimeoutSupplier

      public void openTimeoutSupplier(Supplier<Long> timeoutSupplier)
      A supplier for the Timeout for tripping the open circuit. If the delegate policy cannot retry and the time elapsed since the context was started is less than this window, then the circuit is opened.
      参数:
      timeoutSupplier - a supplier for the timeout to set in milliseconds
    • canRetry

      public boolean canRetry(RetryContext context)
      指定者:
      canRetry 在接口中 RetryPolicy
      参数:
      context - the current retry status
      返回:
      true if the operation can proceed
    • open

      public RetryContext open(RetryContext parent)
      从接口复制的说明: 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.
      指定者:
      open 在接口中 RetryPolicy
      参数:
      parent - the parent context if we are in a nested retry.
      返回:
      a RetryContext object specific to this policy.
    • close

      public void close(RetryContext context)
      指定者:
      close 在接口中 RetryPolicy
      参数:
      context - a retry status created by the RetryPolicy.open(RetryContext) method of this policy.
    • registerThrowable

      public void registerThrowable(RetryContext context, Throwable throwable)
      从接口复制的说明: RetryPolicy
      Called once per retry attempt, after the callback fails.
      指定者:
      registerThrowable 在接口中 RetryPolicy
      参数:
      context - the current status object.
      throwable - the exception to throw