OPEN - issue BATCH-771: Refactor Listeners for chunk changes
Lift Chunk up to top level and use it to manage the skip / retry logic. Not finished.
This commit is contained in:
@@ -28,7 +28,8 @@ public interface RecoveryCallback {
|
||||
* @param context the current retry context
|
||||
* @return an Object that can be used to replace the callback result that
|
||||
* failed
|
||||
* @throws Exception
|
||||
*/
|
||||
Object recover(RetryContext context);
|
||||
Object recover(RetryContext context) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.batch.retry;
|
||||
|
||||
|
||||
/**
|
||||
* A {@link RetryPolicy} is responsible for allocating and managing resources
|
||||
* needed by {@link RetryOperations}. The {@link RetryPolicy} allows retry
|
||||
@@ -57,8 +56,8 @@ public interface RetryPolicy {
|
||||
RetryContext open(RetryCallback callback, RetryContext parent);
|
||||
|
||||
/**
|
||||
* @param context a retry status created by the {@link #open(RetryCallback, RetryContext)}
|
||||
* method of this manager.
|
||||
* @param context a retry status created by the
|
||||
* {@link #open(RetryCallback, RetryContext)} method of this manager.
|
||||
* @param succeeded true if the retry callback succeeded
|
||||
*/
|
||||
void close(RetryContext context, boolean succeeded);
|
||||
@@ -81,6 +80,8 @@ public interface RetryPolicy {
|
||||
* @return an appropriate value possibly from the callback.
|
||||
*
|
||||
* @throws ExhaustedRetryException if there is no recovery path.
|
||||
* @throws Exception in rare cases where the policy wants to propagate the
|
||||
* retryable exception
|
||||
*/
|
||||
Object handleRetryExhausted(RetryContext context) throws ExhaustedRetryException;
|
||||
Object handleRetryExhausted(RetryContext context) throws ExhaustedRetryException, Exception;
|
||||
}
|
||||
|
||||
@@ -57,10 +57,18 @@ public abstract class AbstractStatefulRetryPolicy implements RetryPolicy {
|
||||
|
||||
/**
|
||||
* Return null. Subclasses should provide a recovery path if possible.
|
||||
* Subclasses are also encouraged not to declare throws Exception if they
|
||||
* can (e.g. in the plausible and common case that the recovery is a last
|
||||
* ditch effort to prevent a message going back to the middleware, for
|
||||
* instance). Any subclass that actually does throw an Exception of any type
|
||||
* should be aware that it will simply be propagated and the caller will
|
||||
* have top deal with it.
|
||||
*
|
||||
* @throws Exception if the recovery path demands it
|
||||
*
|
||||
* @see org.springframework.batch.retry.RetryPolicy#handleRetryExhausted(org.springframework.batch.retry.RetryContext)
|
||||
*/
|
||||
public Object handleRetryExhausted(RetryContext context) throws ExhaustedRetryException {
|
||||
public Object handleRetryExhausted(RetryContext context) throws ExhaustedRetryException, Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ public class RecoveryCallbackRetryPolicy extends AbstractStatefulRetryPolicy {
|
||||
*
|
||||
* @see org.springframework.batch.retry.policy.AbstractStatefulRetryPolicy#handleRetryExhausted(org.springframework.batch.retry.RetryContext)
|
||||
*/
|
||||
public Object handleRetryExhausted(RetryContext context) throws ExhaustedRetryException {
|
||||
public Object handleRetryExhausted(RetryContext context) throws Exception, ExhaustedRetryException {
|
||||
return ((RetryPolicy) context).handleRetryExhausted(context);
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ public class RecoveryCallbackRetryPolicy extends AbstractStatefulRetryPolicy {
|
||||
throw new UnsupportedOperationException("Not supported - this code should be unreachable.");
|
||||
}
|
||||
|
||||
public Object handleRetryExhausted(RetryContext context) throws ExhaustedRetryException {
|
||||
public Object handleRetryExhausted(RetryContext context) throws Exception, ExhaustedRetryException {
|
||||
// If there is no going back, then we can remove the history
|
||||
retryContextCache.remove(key);
|
||||
if (recoverer != null) {
|
||||
|
||||
Reference in New Issue
Block a user