com.taleo.integration.client.customstep.util
Class RetryHelper

java.lang.Object
  extended by com.taleo.integration.client.customstep.util.RetryHelper

public final class RetryHelper
extends java.lang.Object

Helper class for retry processing.

Author:
Romain Guay, Taleo Corporation

Field Summary
static int NB_RETRIES_DEFAULT
           
static int RETRY_FACTOR_DEFAULT
           
static int RETRY_INTERVAL_DEFAULT
           
 
Constructor Summary
RetryHelper(int nbRetries, int retryFactor, int retryInterval)
          Constructs a RetryHelper instance.
 
Method Summary
 int getCurrentAttempt()
          Returns the current attempt.
 int getLastWaited()
          Returns the last waited time (seconds).
 int getMaxAttempts()
          Returns the maximum number of attempts.
 int getNbRetries()
          Returns the number of retries.
 int getRetryFactor()
          Returns the retryFactor.
 int getRetryInterval()
          Returns the retry interval.
 void waitForNextRetry()
          If the execution of the method did not complete and we still have retry attempts, wait for the next retry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NB_RETRIES_DEFAULT

public static final int NB_RETRIES_DEFAULT
See Also:
Constant Field Values

RETRY_INTERVAL_DEFAULT

public static final int RETRY_INTERVAL_DEFAULT
See Also:
Constant Field Values

RETRY_FACTOR_DEFAULT

public static final int RETRY_FACTOR_DEFAULT
See Also:
Constant Field Values
Constructor Detail

RetryHelper

public RetryHelper(int nbRetries,
                   int retryFactor,
                   int retryInterval)
Constructs a RetryHelper instance.

Parameters:
nbRetries - max number of retry attempts.
retryFactor - multiplication factor for retrying jobs.
retryInterval - time to wait (seconds).
Method Detail

getLastWaited

public int getLastWaited()
Returns the last waited time (seconds).


getMaxAttempts

public int getMaxAttempts()
Returns the maximum number of attempts.


getCurrentAttempt

public int getCurrentAttempt()
Returns the current attempt.


getNbRetries

public int getNbRetries()
Returns the number of retries.

Returns:
the number of retries.

getRetryFactor

public int getRetryFactor()
Returns the retryFactor.

Returns:
the retryFactor.

getRetryInterval

public int getRetryInterval()
Returns the retry interval.

Returns:
the retry interval.

waitForNextRetry

public void waitForNextRetry()
If the execution of the method did not complete and we still have retry attempts, wait for the next retry.