类 RetryInterceptorBuilder<T extends org.aopalliance.intercept.MethodInterceptor>
java.lang.Object
cn.taketoday.retry.interceptor.RetryInterceptorBuilder<T>
- 类型参数:
T
- The type ofMethodInterceptor
returned by the builder'sbuild()
method.
- 直接已知子类:
RetryInterceptorBuilder.CircuitBreakerInterceptorBuilder
,RetryInterceptorBuilder.StatefulRetryInterceptorBuilder
,RetryInterceptorBuilder.StatelessRetryInterceptorBuilder
public abstract class RetryInterceptorBuilder<T extends org.aopalliance.intercept.MethodInterceptor>
extends Object
Simplified facade to make it easier and simpler to build a
StatefulRetryOperationsInterceptor
or (stateless)
RetryOperationsInterceptor
by providing a fluent interface to defining the
behavior on error.
Typical example:
StatefulRetryOperationsInterceptor interceptor = RetryInterceptorBuilder.stateful() .maxAttempts(5).backOffOptions(1, 2, 10) // initialInterval, multiplier, // maxInterval .build();
- 从以下版本开始:
- 4.0
- 作者:
- James Carr, Gary Russell, Artem Bilan
-
嵌套类概要
修饰符和类型类说明static class
static class
static class
-
字段概要
修饰符和类型字段说明private boolean
private boolean
protected String
protected MethodInvocationRecoverer<?>
protected RetryOperations
private boolean
protected final RetryTemplate
protected final SimpleRetryPolicy
private boolean
-
构造器概要
-
方法概要
修饰符和类型方法说明backOffOptions
(long initialInterval, double multiplier, long maxInterval) Apply the backoff options.backOffPolicy
(BackOffPolicy policy) Apply the back off policy.abstract T
build()
Create a builder for a circuit breaker retry interceptor.maxAttempts
(int maxAttempts) Apply the max attempts - a SimpleRetryPolicy will be used.recoverer
(MethodInvocationRecoverer<?> recoverer) Apply aMethodInvocationRecoverer
for the Retry interceptor.retryOperations
(RetryOperations retryOperations) Apply the retry operations - once this is set, other properties can no longer be set; can't be set if other properties have been applied.retryPolicy
(RetryPolicy policy) Apply the retry policy - cannot be used if a custom retry template has been provided, or the max attempts or back off options or policy have been applied.stateful()
Create a builder for a stateful retry interceptor.Create a builder for a stateless retry interceptor.
-
字段详细资料
-
retryTemplate
-
simpleRetryPolicy
-
retryOperations
-
recoverer
-
templateAltered
private boolean templateAltered -
backOffPolicySet
private boolean backOffPolicySet -
retryPolicySet
private boolean retryPolicySet -
backOffOptionsSet
private boolean backOffOptionsSet -
label
-
-
构造器详细资料
-
RetryInterceptorBuilder
private RetryInterceptorBuilder()
-
-
方法详细资料
-
stateful
Create a builder for a stateful retry interceptor.- 返回:
- The interceptor builder.
-
circuitBreaker
Create a builder for a circuit breaker retry interceptor.- 返回:
- The interceptor builder.
-
stateless
Create a builder for a stateless retry interceptor.- 返回:
- The interceptor builder.
-
retryOperations
Apply the retry operations - once this is set, other properties can no longer be set; can't be set if other properties have been applied.- 参数:
retryOperations
- The retry operations.- 返回:
- this.
-
maxAttempts
Apply the max attempts - a SimpleRetryPolicy will be used. Cannot be used if a custom retry operations or retry policy has been set.- 参数:
maxAttempts
- the max attempts (including the initial attempt).- 返回:
- this.
-
backOffOptions
public RetryInterceptorBuilder<T> backOffOptions(long initialInterval, double multiplier, long maxInterval) Apply the backoff options. Cannot be used if a custom retry operations, or back off policy has been set.- 参数:
initialInterval
- The initial interval.multiplier
- The multiplier.maxInterval
- The max interval.- 返回:
- this.
-
retryPolicy
Apply the retry policy - cannot be used if a custom retry template has been provided, or the max attempts or back off options or policy have been applied.- 参数:
policy
- The policy.- 返回:
- this.
-
backOffPolicy
Apply the back off policy. Cannot be used if a custom retry operations, or back off policy has been applied.- 参数:
policy
- The policy.- 返回:
- this.
-
recoverer
Apply aMethodInvocationRecoverer
for the Retry interceptor.- 参数:
recoverer
- The recoverer.- 返回:
- this.
-
label
-
build
-