Class RetryInterceptorBuilder.StatefulRetryInterceptorBuilder
java.lang.Object
org.springframework.retry.interceptor.RetryInterceptorBuilder<StatefulRetryOperationsInterceptor>
org.springframework.retry.interceptor.RetryInterceptorBuilder.StatefulRetryInterceptorBuilder
- Enclosing class:
- RetryInterceptorBuilder<T extends org.aopalliance.intercept.MethodInterceptor>
public static class RetryInterceptorBuilder.StatefulRetryInterceptorBuilder
extends RetryInterceptorBuilder<StatefulRetryOperationsInterceptor>
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.retry.interceptor.RetryInterceptorBuilder
RetryInterceptorBuilder.CircuitBreakerInterceptorBuilder, RetryInterceptorBuilder.StatefulRetryInterceptorBuilder, RetryInterceptorBuilder.StatelessRetryInterceptorBuilder -
Field Summary
Fields inherited from class org.springframework.retry.interceptor.RetryInterceptorBuilder
label, recoverer, retryOperations, retryTemplate, simpleRetryPolicy -
Method Summary
Modifier and TypeMethodDescriptionbackOffOptions(long initialInterval, double multiplier, long maxInterval) Apply the backoff options.backOffPolicy(BackOffPolicy policy) Apply the back off policy.build()keyGenerator(MethodArgumentsKeyGenerator keyGenerator) Stateful retry requires items to be identifiable.maxAttempts(int maxAttempts) Apply the max attempts - a SimpleRetryPolicy will be used.newMethodArgumentsIdentifier(NewMethodArgumentsIdentifier newMethodArgumentsIdentifier) Apply a custom new item identifier.recoverer(MethodInvocationRecoverer<?> recoverer) Apply aMethodInvocationRecovererfor 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.rollbackFor(Classifier<? super Throwable, Boolean> rollbackClassifier) Control the rollback of an ongoing transaction.Methods inherited from class org.springframework.retry.interceptor.RetryInterceptorBuilder
circuitBreaker, label, stateful, stateless
-
Method Details
-
keyGenerator
public RetryInterceptorBuilder.StatefulRetryInterceptorBuilder keyGenerator(MethodArgumentsKeyGenerator keyGenerator) Stateful retry requires items to be identifiable.- Parameters:
keyGenerator- The key generator.- Returns:
- this.
-
newMethodArgumentsIdentifier
public RetryInterceptorBuilder.StatefulRetryInterceptorBuilder newMethodArgumentsIdentifier(NewMethodArgumentsIdentifier newMethodArgumentsIdentifier) Apply a custom new item identifier.- Parameters:
newMethodArgumentsIdentifier- The new item identifier.- Returns:
- this.
-
rollbackFor
public RetryInterceptorBuilder.StatefulRetryInterceptorBuilder rollbackFor(Classifier<? super Throwable, Boolean> rollbackClassifier) Control the rollback of an ongoing transaction. In a stateful retry, normally all exceptions cause a rollback (i.e. re-throw).- Parameters:
rollbackClassifier- The rollback classifier (return true for exceptions that should be re-thrown).- Returns:
- this.
-
retryOperations
public RetryInterceptorBuilder.StatefulRetryInterceptorBuilder retryOperations(RetryOperations retryOperations) Description copied from class:RetryInterceptorBuilderApply the retry operations - once this is set, other properties can no longer be set; can't be set if other properties have been applied.- Overrides:
retryOperationsin classRetryInterceptorBuilder<StatefulRetryOperationsInterceptor>- Parameters:
retryOperations- The retry operations.- Returns:
- this.
-
maxAttempts
Description copied from class:RetryInterceptorBuilderApply the max attempts - a SimpleRetryPolicy will be used. Cannot be used if a custom retry operations or retry policy has been set.- Overrides:
maxAttemptsin classRetryInterceptorBuilder<StatefulRetryOperationsInterceptor>- Parameters:
maxAttempts- the max attempts (including the initial attempt).- Returns:
- this.
-
backOffOptions
public RetryInterceptorBuilder.StatefulRetryInterceptorBuilder backOffOptions(long initialInterval, double multiplier, long maxInterval) Description copied from class:RetryInterceptorBuilderApply the backoff options. Cannot be used if a custom retry operations, or back off policy has been set.- Overrides:
backOffOptionsin classRetryInterceptorBuilder<StatefulRetryOperationsInterceptor>- Parameters:
initialInterval- The initial interval.multiplier- The multiplier.maxInterval- The max interval.- Returns:
- this.
-
retryPolicy
Description copied from class:RetryInterceptorBuilderApply 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.- Overrides:
retryPolicyin classRetryInterceptorBuilder<StatefulRetryOperationsInterceptor>- Parameters:
policy- The policy.- Returns:
- this.
-
backOffPolicy
Description copied from class:RetryInterceptorBuilderApply the back off policy. Cannot be used if a custom retry operations, or back off policy has been applied.- Overrides:
backOffPolicyin classRetryInterceptorBuilder<StatefulRetryOperationsInterceptor>- Parameters:
policy- The policy.- Returns:
- this.
-
recoverer
public RetryInterceptorBuilder.StatefulRetryInterceptorBuilder recoverer(MethodInvocationRecoverer<?> recoverer) Description copied from class:RetryInterceptorBuilderApply aMethodInvocationRecovererfor the Retry interceptor.- Overrides:
recovererin classRetryInterceptorBuilder<StatefulRetryOperationsInterceptor>- Parameters:
recoverer- The recoverer.- Returns:
- this.
-
build
- Specified by:
buildin classRetryInterceptorBuilder<StatefulRetryOperationsInterceptor>
-