com.gisgraphy.helper
Class RetryOnErrorTemplate<T>
java.lang.Object
com.gisgraphy.helper.RetryOnErrorTemplate<T>
public abstract class RetryOnErrorTemplate<T>
- extends java.lang.Object
Give the ability to retry a function multiple times if it fails.
usage :
RetryOnErrorTemplate<String> retryOnError = new RetryOnErrorTemplate<String>() {
public String tryThat() throws Exception {
return THE_RETURNED_VALUE;
}
};
retryOnError.times(3)
- Author:
- David Masclet
Field Summary |
protected static org.slf4j.Logger |
logger
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected static final org.slf4j.Logger logger
RetryOnErrorTemplate
public RetryOnErrorTemplate()
tryThat
public abstract T tryThat()
throws java.lang.Exception
- Throws:
java.lang.Exception
times
public T times(int numberOfTry)
throws java.lang.Exception
- Throws:
java.lang.Exception
getAlreadyTry
public int getAlreadyTry()
- Returns:
- The number of times the code has already been try
getNumberOfTimesToRetry
public int getNumberOfTimesToRetry()
- Returns:
- The number of times the code should be try
getLoggingSentence
public java.lang.String getLoggingSentence()
- Returns:
- the loggingSentence
setLoggingSentence
public void setLoggingSentence(java.lang.String loggingSentence)
- Parameters:
loggingSentence
- the loggingSentence to set
Copyright © 2010. All Rights Reserved.