/** * 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"); } }
/** * Construct a new {@link RepeatContextCounter}. * * @param context the current context. * @param countKey the key to use to store the counter in the context. * @param useParent true if the counter is to be shared between siblings. * The state will be stored in the parent of the context (if it exists) * instead of the context itself. */ public RepeatContextCounter(RepeatContext context, String countKey, boolean useParent) { super(); Assert.notNull(context, "The context must be provided to initialize a counter"); this.countKey = countKey; this.useParent = useParent; RepeatContext parent = context.getParent(); if (this.useParent && parent != null) { this.context = parent; } else { this.context = context; } if (!this.context.hasAttribute(countKey)) { this.context.setAttribute(countKey, new AtomicInteger()); } }
/** * 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.batch.retry.RetryListener#close(org.springframework.batch.retry.RetryContext, * org.springframework.batch.retry.RetryCallback, java.lang.Throwable) */ public <T> void close(RetryContext context, RetryCallback<T> callback, Throwable throwable) { if (!retryPolicy.canRetry(context)) { logger.debug("Marking retry as exhausted: "+context); getRepeatContext().setAttribute(EXHAUSTED, "true"); } }
/** * 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"); } }
/** * 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"); } }
/** * 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"); } }
/** * Construct a new {@link RepeatContextCounter}. * * @param context the current context. * @param countKey the key to use to store the counter in the context. * @param useParent true if the counter is to be shared between siblings. * The state will be stored in the parent of the context (if it exists) * instead of the context itself. */ public RepeatContextCounter(RepeatContext context, String countKey, boolean useParent) { super(); Assert.notNull(context, "The context must be provided to initialize a counter"); this.countKey = countKey; this.useParent = useParent; RepeatContext parent = context.getParent(); if (this.useParent && parent != null) { this.context = parent; } else { this.context = context; } if (!this.context.hasAttribute(countKey)) { this.context.setAttribute(countKey, new AtomicInteger()); } }