Package org.alfresco.ibatis
Class RetryingCallbackHelper
java.lang.Object
org.alfresco.ibatis.RetryingCallbackHelper
A helper that runs a unit of work, transparently retrying the unit of work if
an error occurs.
Defaults:
- maxRetries: 5
- retryWaitMs: 10
- Since:
- 3.4
- Author:
- Derek Hulley
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback interface -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<R> RdoWithRetry(RetryingCallbackHelper.RetryingCallback<R> callback) Execute a callback until it succeeds, fails or until a maximum number of retries have been attempted.voidsetMaxRetries(int maxRetries) Set the maximimum number of retries. -1 for infinity.voidsetRetryWaitMs(int retryWaitMs)
-
Constructor Details
-
RetryingCallbackHelper
public RetryingCallbackHelper()Default constructor.
-
-
Method Details
-
setMaxRetries
public void setMaxRetries(int maxRetries) Set the maximimum number of retries. -1 for infinity. -
setRetryWaitMs
public void setRetryWaitMs(int retryWaitMs) -
doWithRetry
Execute a callback until it succeeds, fails or until a maximum number of retries have been attempted.- Parameters:
callback- The callback containing the unit of work.- Returns:
- Returns the result of the unit of work.
- Throws:
RuntimeException- all checked exceptions are converted
-