/** * Decide whether to proceed with the ongoing retry attempt. This method is called * before the {@link RetryCallback} is executed, but after the backoff and open * interceptors. * * @param retryPolicy the policy to apply * @param context the current retry context * @return true if we can continue with the attempt */ protected boolean canRetry(RetryPolicy retryPolicy, RetryContext context) { return retryPolicy.canRetry(context); }
/** * Delegate to the policy currently activated in the context. * * @see org.springframework.retry.RetryPolicy#canRetry(org.springframework.retry.RetryContext) */ public boolean canRetry(RetryContext context) { RetryPolicy policy = (RetryPolicy) context; return policy.canRetry(context); }
public boolean canRetry(RetryContext context) { return context==null ? true : retryPolicy.canRetry(context); }
public boolean canRetry(RetryContext context) { return this.context == null || policy.canRetry(this.context); }
/** * Delegate to the policies that were in operation when the context was * created. If any of them cannot retry then return false, otherwise return * true. * * @param context the {@link RetryContext} * @see org.springframework.retry.RetryPolicy#canRetry(org.springframework.retry.RetryContext) */ @Override public boolean canRetry(RetryContext context) { RetryContext[] contexts = ((CompositeRetryContext) context).contexts; RetryPolicy[] policies = ((CompositeRetryContext) context).policies; boolean retryable = true; if(this.optimistic) { retryable = false; for (int i = 0; i < contexts.length; i++) { if (policies[i].canRetry(contexts[i])) { retryable = true; } } } else { for (int i = 0; i < contexts.length; i++) { if (!policies[i].canRetry(contexts[i])) { retryable = false; } } } return retryable; }
/** * If retry is exhausted set up some state in the context that can be used * to signal that the exception should be handled. * * @see org.springframework.retry.RetryListener#close(org.springframework.retry.RetryContext, * org.springframework.retry.RetryCallback, java.lang.Throwable) */ @Override public <T, E extends Throwable> void close(RetryContext context, RetryCallback<T, E> callback, Throwable throwable) { if (!retryPolicy.canRetry(context)) { if (logger.isDebugEnabled()) { logger.debug("Marking retry as exhausted: "+context); } getRepeatContext().setAttribute(EXHAUSTED, "true"); } }
@Override public boolean canRetry(RetryContext context) { CircuitBreakerRetryContext circuit = (CircuitBreakerRetryContext) context; if (circuit.isOpen()) { circuit.incrementShortCircuitCount(); return false; } else { circuit.reset(); } return this.delegate.canRetry(circuit.context); }
public boolean isOpen() { long time = System.currentTimeMillis() - this.start; boolean retryable = this.policy.canRetry(this.context); if (!retryable) { if (time > this.timeout) { this.context = createDelegateContext(policy, getParent()); this.start = System.currentTimeMillis(); retryable = this.policy.canRetry(this.context);
@Override public boolean canRetry(RetryContext context) { return delegate.canRetry(context); }
/** * Delegate to the policy currently activated in the context. * * @see org.springframework.retry.RetryPolicy#canRetry(org.springframework.retry.RetryContext) */ public boolean canRetry(RetryContext context) { RetryPolicy policy = (RetryPolicy) context; return policy.canRetry(context); }
/** * {@inheritDoc} */ @Override public boolean canRetry(RetryContext context) { return delegate.canRetry(context); }
/** * Decide whether to proceed with the ongoing retry attempt. This method is called * before the {@link RetryCallback} is executed, but after the backoff and open * interceptors. * * @param retryPolicy the policy to apply * @param context the current retry context * @return true if we can continue with the attempt */ protected boolean canRetry(RetryPolicy retryPolicy, RetryContext context) { return retryPolicy.canRetry(context); }
@Override public boolean canRetry(RetryContext context) { return delegate.canRetry(context); }
/** * {@inheritDoc} */ @Override public boolean canRetry(RetryContext context) { return delegate.canRetry(context); }
public boolean canRetry(RetryContext context) { return context==null ? true : retryPolicy.canRetry(context); }
public boolean canRetry(RetryContext context) { return this.context == null || policy.canRetry(this.context); }
public boolean canRetry(RetryContext context) { return context==null ? true : retryPolicy.canRetry(context); }
public boolean canRetry(RetryContext context) { return context==null ? true : retryPolicy.canRetry(context); }
/** * If retry is exhausted set up some state in the context that can be used * to signal that the exception should be handled. * * @see org.springframework.retry.RetryListener#close(org.springframework.retry.RetryContext, * org.springframework.retry.RetryCallback, java.lang.Throwable) */ @Override public <T, E extends Throwable> void close(RetryContext context, RetryCallback<T, E> callback, Throwable throwable) { if (!retryPolicy.canRetry(context)) { logger.debug("Marking retry as exhausted: "+context); getRepeatContext().setAttribute(EXHAUSTED, "true"); } }
@Override public boolean canRetry(RetryContext context) { CircuitBreakerRetryContext circuit = (CircuitBreakerRetryContext) context; if (circuit.isOpen()) { circuit.incrementShortCircuitCount(); return false; } else { circuit.reset(); } return this.delegate.canRetry(circuit.context); }