org.springframework.batch.retry
Interface RetryOperations

All Known Implementing Classes:
BatchRetryTemplate, RetryTemplate

public interface RetryOperations

Defines the basic set of operations implemented by RetryOperations to execute operations with configurable retry behaviour.

Author:
Rob Harrop, Dave Syer

Method Summary
<T> T
execute(RetryCallback<T> retryCallback)
          Execute the supplied RetryCallback with the configured retry semantics.
<T> T
execute(RetryCallback<T> retryCallback, RecoveryCallback<T> recoveryCallback)
          Execute the supplied RetryCallback with a fallback on exhausted retry to the RecoveryCallback.
<T> T
execute(RetryCallback<T> retryCallback, RecoveryCallback<T> recoveryCallback, RetryState retryState)
          A stateful retry with a recovery path.
<T> T
execute(RetryCallback<T> retryCallback, RetryState retryState)
          A simple stateful retry.
 

Method Detail

execute

<T> T execute(RetryCallback<T> retryCallback)
          throws Exception
Execute the supplied RetryCallback with the configured retry semantics. See implementations for configuration details.

Returns:
the value returned by the RetryCallback upon successful invocation.
Throws:
Exception - any Exception raised by the RetryCallback upon unsuccessful retry.

execute

<T> T execute(RetryCallback<T> retryCallback,
              RecoveryCallback<T> recoveryCallback)
          throws Exception
Execute the supplied RetryCallback with a fallback on exhausted retry to the RecoveryCallback. See implementations for configuration details.

Returns:
the value returned by the RetryCallback upon successful invocation, and that returned by the RecoveryCallback otherwise.
Throws:
Exception - any Exception raised by the RecoveryCallback upon unsuccessful retry.

execute

<T> T execute(RetryCallback<T> retryCallback,
              RetryState retryState)
          throws Exception,
                 ExhaustedRetryException
A simple stateful retry. Execute the supplied RetryCallback with a target object for the attempt identified by the DefaultRetryState. Exceptions thrown by the callback are always propagated immediately so the state is required to be able to identify the previous attempt, if there is one - hence the state is required. Normal patterns would see this method being used inside a transaction, where the callback might invalidate the transaction if it fails.

See implementations for configuration details.

Returns:
the value returned by the RetryCallback upon successful invocation, and that returned by the RecoveryCallback otherwise.
Throws:
Exception - any Exception raised by the RecoveryCallback.
ExhaustedRetryException - if the last attempt for this state has already been reached

execute

<T> T execute(RetryCallback<T> retryCallback,
              RecoveryCallback<T> recoveryCallback,
              RetryState retryState)
          throws Exception
A stateful retry with a recovery path. Execute the supplied RetryCallback with a fallback on exhausted retry to the RecoveryCallback and a target object for the retry attempt identified by the DefaultRetryState.

Returns:
the value returned by the RetryCallback upon successful invocation, and that returned by the RecoveryCallback otherwise.
Throws:
Exception - any Exception raised by the RecoveryCallback upon unsuccessful retry.
See Also:
execute(RetryCallback, RetryState)


Copyright © 2013 SpringSource. All Rights Reserved.