T
- The type of MethodInterceptor
returned by
the builder's build()
method.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();
Modifier and Type | Class and Description |
---|---|
static class |
RetryInterceptorBuilder.CircuitBreakerInterceptorBuilder |
static class |
RetryInterceptorBuilder.StatefulRetryInterceptorBuilder |
static class |
RetryInterceptorBuilder.StatelessRetryInterceptorBuilder |
Modifier and Type | Field and Description |
---|---|
protected String |
label |
protected MethodInvocationRecoverer<?> |
recoverer |
protected RetryOperations |
retryOperations |
protected RetryTemplate |
retryTemplate |
protected SimpleRetryPolicy |
simpleRetryPolicy |
Modifier and Type | Method and Description |
---|---|
RetryInterceptorBuilder<T> |
backOffOptions(long initialInterval,
double multiplier,
long maxInterval)
Apply the backoff options.
|
RetryInterceptorBuilder<T> |
backOffPolicy(BackOffPolicy policy)
Apply the back off policy.
|
abstract T |
build() |
static RetryInterceptorBuilder.CircuitBreakerInterceptorBuilder |
circuitBreaker()
Create a builder for a circuit breaker retry interceptor.
|
RetryInterceptorBuilder<T> |
label(String label) |
RetryInterceptorBuilder<T> |
maxAttempts(int maxAttempts)
Apply the max attempts - a SimpleRetryPolicy will be used.
|
RetryInterceptorBuilder<T> |
recoverer(MethodInvocationRecoverer<?> recoverer)
Apply a
MethodInvocationRecoverer for the Retry interceptor. |
RetryInterceptorBuilder<T> |
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.
|
RetryInterceptorBuilder<T> |
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.
|
static RetryInterceptorBuilder.StatefulRetryInterceptorBuilder |
stateful()
Create a builder for a stateful retry interceptor.
|
static RetryInterceptorBuilder.StatelessRetryInterceptorBuilder |
stateless()
Create a builder for a stateless retry interceptor.
|
protected final RetryTemplate retryTemplate
protected final SimpleRetryPolicy simpleRetryPolicy
protected RetryOperations retryOperations
protected MethodInvocationRecoverer<?> recoverer
protected String label
public static RetryInterceptorBuilder.StatefulRetryInterceptorBuilder stateful()
public static RetryInterceptorBuilder.CircuitBreakerInterceptorBuilder circuitBreaker()
public static RetryInterceptorBuilder.StatelessRetryInterceptorBuilder stateless()
public RetryInterceptorBuilder<T> retryOperations(RetryOperations retryOperations)
retryOperations
- The retry operations.public RetryInterceptorBuilder<T> maxAttempts(int maxAttempts)
maxAttempts
- the max attempts (including the initial attempt).public RetryInterceptorBuilder<T> backOffOptions(long initialInterval, double multiplier, long maxInterval)
initialInterval
- The initial interval.multiplier
- The multiplier.maxInterval
- The max interval.public RetryInterceptorBuilder<T> retryPolicy(RetryPolicy policy)
policy
- The policy.public RetryInterceptorBuilder<T> backOffPolicy(BackOffPolicy policy)
policy
- The policy.public RetryInterceptorBuilder<T> recoverer(MethodInvocationRecoverer<?> recoverer)
MethodInvocationRecoverer
for the Retry interceptor.recoverer
- The recoverer.public RetryInterceptorBuilder<T> label(String label)
public abstract T build()
Copyright © 2018 SpringSource. All rights reserved.