org.springframework.batch.retry.policy
Class AbstractStatelessRetryPolicy

java.lang.Object
  extended by org.springframework.batch.retry.policy.AbstractStatelessRetryPolicy
All Implemented Interfaces:
RetryPolicy
Direct Known Subclasses:
CompositeRetryPolicy, ExceptionClassifierRetryPolicy, NeverRetryPolicy, SimpleRetryPolicy, TimeoutRetryPolicy

public abstract class AbstractStatelessRetryPolicy
extends Object
implements RetryPolicy

Base class for "normal" retry policies: those that operate in the context of a callback that is called repeatedly in a loop until it succeeds, or the policy decides to terminate. There is no need for such policies to store state outside the context.

Author:
Dave Syer
See Also:
RetryPolicy.handleRetryExhausted(RetryContext), AbstractStatefulRetryPolicy

Constructor Summary
AbstractStatelessRetryPolicy()
           
 
Method Summary
 Object handleRetryExhausted(RetryContext context)
          Throw an exception.
 boolean shouldRethrow(RetryContext context)
          Just returns the negative of RetryPolicy.canRetry(RetryContext), i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.batch.retry.RetryPolicy
canRetry, close, open, registerThrowable
 

Constructor Detail

AbstractStatelessRetryPolicy

public AbstractStatelessRetryPolicy()
Method Detail

shouldRethrow

public boolean shouldRethrow(RetryContext context)
Just returns the negative of RetryPolicy.canRetry(RetryContext), i.e. if we cannot retry then the exception should be thrown.

Specified by:
shouldRethrow in interface RetryPolicy
Parameters:
context - the current context.
Returns:
true if the policy determines that the last exception should be re-thrown.
See Also:
RetryPolicy.shouldRethrow(org.springframework.batch.retry.RetryContext)

handleRetryExhausted

public Object handleRetryExhausted(RetryContext context)
                            throws ExhaustedRetryException
Throw an exception.

Specified by:
handleRetryExhausted in interface RetryPolicy
Parameters:
context - the current retry context.
Returns:
an appropriate value possibly from the callback.
Throws:
ExhaustedRetryException - if there is no recovery path.
See Also:
RetryPolicy.handleRetryExhausted(org.springframework.batch.retry.RetryContext)


Copyright © 2009 SpringSource. All Rights Reserved.