@Override public CircuitBreakerInterceptorBuilder maxAttempts(int maxAttempts) { super.maxAttempts(maxAttempts); return this; }
@Override public StatefulRetryInterceptorBuilder retryOperations( RetryOperations retryOperations) { super.retryOperations(retryOperations); return this; }
@Override public CircuitBreakerInterceptorBuilder retryPolicy(RetryPolicy policy) { super.retryPolicy(policy); return this; }
@Bean @ConditionalOnMissingBean(name = "configServerRetryInterceptor") public RetryOperationsInterceptor configServerRetryInterceptor( RetryProperties properties) { return RetryInterceptorBuilder .stateless() .backOffOptions(properties.getInitialInterval(), properties.getMultiplier(), properties.getMaxInterval()) .maxAttempts(properties.getMaxAttempts()).build(); } }
@Override public StatefulRetryOperationsInterceptor build() { if (this.recoverer != null) { this.interceptor.setRecoverer(this.recoverer); } if (this.retryOperations != null) { this.interceptor.setRetryOperations(this.retryOperations); } else { this.interceptor.setRetryOperations(this.retryTemplate); } if (this.keyGenerator != null) { this.interceptor.setKeyGenerator(this.keyGenerator); } if (this.rollbackClassifier != null) { this.interceptor.setRollbackClassifier(this.rollbackClassifier); } if (this.newMethodArgumentsIdentifier != null) { this.interceptor.setNewItemIdentifier(this.newMethodArgumentsIdentifier); } if (this.label != null) { this.interceptor.setLabel(this.label); } return this.interceptor; }
private MethodInterceptor getStatelessInterceptor(Object target, Method method, Retryable retryable) { RetryTemplate template = createTemplate(retryable.listeners()); template.setRetryPolicy(getRetryPolicy(retryable)); template.setBackOffPolicy(getBackoffPolicy(retryable.backoff())); return RetryInterceptorBuilder.stateless() .retryOperations(template) .label(retryable.label()) .recoverer(getRecoverer(target, method)) .build(); }
@Override public RetryOperationsInterceptor build() { if (this.recoverer != null) { this.interceptor.setRecoverer(this.recoverer); } if (this.retryOperations != null) { this.interceptor.setRetryOperations(this.retryOperations); } else { this.interceptor.setRetryOperations(this.retryTemplate); } if (this.label != null) { this.interceptor.setLabel(this.label); } return this.interceptor; }
@Override public Object recover(RetryContext context) { return this.recoverer.recover(this.args, context.getLastThrowable()); }
@Override public CircuitBreakerInterceptorBuilder recoverer( MethodInvocationRecoverer<?> recoverer) { super.recoverer(recoverer); return this; }
/** * Create a builder for a circuit breaker retry interceptor. * @return The interceptor builder. */ public static CircuitBreakerInterceptorBuilder circuitBreaker() { return new CircuitBreakerInterceptorBuilder(); }
@Override public StatefulRetryInterceptorBuilder backOffPolicy(BackOffPolicy policy) { super.backOffPolicy(policy); return this; }
/** * Create a builder for a stateful retry interceptor. * @return The interceptor builder. */ public static StatefulRetryInterceptorBuilder stateful() { return new StatefulRetryInterceptorBuilder(); }
/** * Create a builder for a stateless retry interceptor. * @return The interceptor builder. */ public static StatelessRetryInterceptorBuilder stateless() { return new StatelessRetryInterceptorBuilder(); }
@Override public StatefulRetryInterceptorBuilder backOffOptions(long initialInterval, double multiplier, long maxInterval) { super.backOffOptions(initialInterval, multiplier, maxInterval); return this; }
@Override public StatefulRetryInterceptorBuilder maxAttempts(int maxAttempts) { super.maxAttempts(maxAttempts); return this; }
public Object recover(RetryContext context) { return recoverer.recover(args, context.getLastThrowable()); }
@Override public CircuitBreakerInterceptorBuilder retryOperations( RetryOperations retryOperations) { super.retryOperations(retryOperations); return this; }
@Override public StatefulRetryInterceptorBuilder retryPolicy(RetryPolicy policy) { super.retryPolicy(policy); return this; }
@Override public StatefulRetryInterceptorBuilder recoverer( MethodInvocationRecoverer<?> recoverer) { super.recoverer(recoverer); return this; }
public void testRecover() throws Exception { try { recoverer.recover(new Object[]{"foo"}, null); } catch (Exception e) { fail("Unexpected Exception"); } } }