org.springframework.batch.retry.context
Class RetryContextSupport

java.lang.Object
  extended by org.springframework.core.AttributeAccessorSupport
      extended by org.springframework.batch.retry.context.RetryContextSupport
All Implemented Interfaces:
Serializable, RetryContext, AttributeAccessor

public class RetryContextSupport
extends AttributeAccessorSupport
implements RetryContext

See Also:
Serialized Form

Constructor Summary
RetryContextSupport(RetryContext parent)
           
 
Method Summary
 Throwable getLastThrowable()
          Accessor for the exception object that caused the current retry.
 RetryContext getParent()
          Accessor for the parent context if retry blocks are nested.
 int getRetryCount()
          Counts the number of retry attempts.
 boolean isExhaustedOnly()
          Public accessor for the exhausted flag RetryContext.setExhaustedOnly().
 void registerThrowable(Throwable throwable)
          Set the exception for the public interface RetryContext, and also increment the retry count if the throwable is non-null.
All RetryPolicy implementations should use this method when they register the throwable.
 void setExhaustedOnly()
          Signal to the framework that no more attempts should be made to try or retry the current RetryCallback.
 
Methods inherited from class org.springframework.core.AttributeAccessorSupport
attributeNames, copyAttributesFrom, equals, getAttribute, hasAttribute, hashCode, removeAttribute, setAttribute
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.core.AttributeAccessor
attributeNames, getAttribute, hasAttribute, removeAttribute, setAttribute
 

Constructor Detail

RetryContextSupport

public RetryContextSupport(RetryContext parent)
Method Detail

getParent

public RetryContext getParent()
Description copied from interface: RetryContext
Accessor for the parent context if retry blocks are nested.

Specified by:
getParent in interface RetryContext
Returns:
the parent or null if there is none.

isExhaustedOnly

public boolean isExhaustedOnly()
Description copied from interface: RetryContext
Public accessor for the exhausted flag RetryContext.setExhaustedOnly().

Specified by:
isExhaustedOnly in interface RetryContext
Returns:
true if the flag has been set.

setExhaustedOnly

public void setExhaustedOnly()
Description copied from interface: RetryContext
Signal to the framework that no more attempts should be made to try or retry the current RetryCallback.

Specified by:
setExhaustedOnly in interface RetryContext

getRetryCount

public int getRetryCount()
Description copied from interface: RetryContext
Counts the number of retry attempts. Before the first attempt this counter is zero, and before the first and subsequent attempts it should increment accordingly.

Specified by:
getRetryCount in interface RetryContext
Returns:
the number of retries.

getLastThrowable

public Throwable getLastThrowable()
Description copied from interface: RetryContext
Accessor for the exception object that caused the current retry.

Specified by:
getLastThrowable in interface RetryContext
Returns:
the last exception that caused a retry, or possibly null. It will be null if this is the first attempt, but also if the enclosing policy decides not to provide it (e.g. because of concerns about memory usage).

registerThrowable

public void registerThrowable(Throwable throwable)
Set the exception for the public interface RetryContext, and also increment the retry count if the throwable is non-null.
All RetryPolicy implementations should use this method when they register the throwable. It should only be called once per retry attempt because it increments the conter.
Use of this method is not enforced by the framework - it is a service provider contract for authors of policies.

Parameters:
throwable - the exception that caused the current retry attempt to fail.


Copyright © 2009 SpringSource. All Rights Reserved.