com.alarmpoint.integrationagent.exceptions.retriable
Class FixedDelayPolicy

java.lang.Object
  extended by com.alarmpoint.integrationagent.exceptions.retriable.FixedDelayPolicy
All Implemented Interfaces:
DelayPolicy

public class FixedDelayPolicy
extends java.lang.Object
implements DelayPolicy

A policy that specifies a fixed delay between retry attempts.


Constructor Summary
FixedDelayPolicy(long delayMillis)
          Default constructor.
 
Method Summary
 long getDelay(int numAttempts, long lastDelay)
          Gets the minimum amount of time that must elapse before the next retry attempt.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedDelayPolicy

public FixedDelayPolicy(long delayMillis)
Default constructor.

Parameters:
delayMillis - - the miminum delay (in milliseconds) between each retry attempt; must be >= 0 with 0 indicating no delay
Method Detail

getDelay

public long getDelay(int numAttempts,
                     long lastDelay)
Gets the minimum amount of time that must elapse before the next retry attempt.

Specified by:
getDelay in interface DelayPolicy
Parameters:
numAttempts - - the number of previous attempts (including first attempt and retries); assumed to be >= 1
lastDelay - - the delay (in milliseconds) returned by the previous call to this method (i.e., with numAttempts-1); -1 if not previously code (i.e., when numAttempts==0
Returns:
a non-negative integer indicating the delay in milliseconds