org.springframework.retry
Interface RetryPolicy

All Known Implementing Classes:
AlwaysRetryPolicy, CompositeRetryPolicy, ExceptionClassifierRetryPolicy, NeverRetryPolicy, SimpleRetryPolicy, TimeoutRetryPolicy

public interface RetryPolicy

A RetryPolicy is responsible for allocating and managing resources needed by RetryOperations. The RetryPolicy allows retry operations to be aware of their context. Context can be internal to the retry framework, e.g. to support nested retries. Context can also be external, and the RetryPolicy provides a uniform API for a range of different platforms for the external context.

Author:
Dave Syer

Method Summary
 boolean canRetry(RetryContext context)
           
 void close(RetryContext context)
           
 RetryContext open(RetryContext parent)
          Acquire resources needed for the retry operation.
 void registerThrowable(RetryContext context, java.lang.Throwable throwable)
          Called once per retry attempt, after the callback fails.
 

Method Detail

canRetry

boolean canRetry(RetryContext context)
Parameters:
context - the current retry status
Returns:
true if the operation can proceed

open

RetryContext open(RetryContext parent)
Acquire resources needed for the retry operation. The callback is passed in so that marker interfaces can be used and a manager can collaborate with the callback to set up some state in the status token.

Parameters:
parent - the parent context if we are in a nested retry.
Returns:
a RetryContext object specific to this manager.

close

void close(RetryContext context)
Parameters:
context - a retry status created by the open(RetryContext) method of this manager.

registerThrowable

void registerThrowable(RetryContext context,
                       java.lang.Throwable throwable)
Called once per retry attempt, after the callback fails.

Parameters:
context - the current status object.


Copyright © 2011 SpringSource. All Rights Reserved.