org.springframework.batch.retry.policy
Class NeverRetryPolicy

java.lang.Object
  extended by org.springframework.batch.retry.policy.NeverRetryPolicy
All Implemented Interfaces:
RetryPolicy
Direct Known Subclasses:
AlwaysRetryPolicy

public class NeverRetryPolicy
extends Object
implements RetryPolicy

A RetryPolicy that allows the first attempt but never permits a retry. Also be used as a base class for other policies, e.g. for test purposes as a stub.

Author:
Dave Syer

Constructor Summary
NeverRetryPolicy()
           
 
Method Summary
 boolean canRetry(RetryContext context)
          Returns false after the first exception.
 void close(RetryContext context)
          Do nothing.
 RetryContext open(RetryContext parent)
          Return a context that can respond to early termination requests, but does nothing else.
 void registerThrowable(RetryContext context, Throwable throwable)
          Make the throwable available for downstream use through the context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NeverRetryPolicy

public NeverRetryPolicy()
Method Detail

canRetry

public boolean canRetry(RetryContext context)
Returns false after the first exception. So there is always one try, and then the retry is prevented.

Specified by:
canRetry in interface RetryPolicy
Parameters:
context - the current retry status
Returns:
true if the operation can proceed
See Also:
RetryPolicy.canRetry(org.springframework.batch.retry.RetryContext)

close

public void close(RetryContext context)
Do nothing.

Specified by:
close in interface RetryPolicy
Parameters:
context - a retry status created by the RetryPolicy.open(RetryContext) method of this manager.
See Also:
RetryPolicy.close(org.springframework.batch.retry.RetryContext)

open

public RetryContext open(RetryContext parent)
Return a context that can respond to early termination requests, but does nothing else.

Specified by:
open in interface RetryPolicy
Parameters:
parent - the parent context if we are in a nested retry.
Returns:
a RetryContext object specific to this manager.
See Also:
RetryPolicy.open(RetryContext)

registerThrowable

public void registerThrowable(RetryContext context,
                              Throwable throwable)
Make the throwable available for downstream use through the context.

Specified by:
registerThrowable in interface RetryPolicy
Parameters:
context - the current status object.
See Also:
RetryPolicy.registerThrowable(org.springframework.batch.retry.RetryContext, Throwable)


Copyright © 2013 SpringSource. All Rights Reserved.