Class ExponentialBackOffTrigger
- java.lang.Object
-
- com.netflix.genie.common.internal.util.ExponentialBackOffTrigger
-
- All Implemented Interfaces:
org.springframework.scheduling.Trigger
@ThreadSafe public class ExponentialBackOffTrigger extends java.lang.Object implements org.springframework.scheduling.TriggerTrigger implementation whose scheduling delay grows exponentially based on a given factor. The delay is bound between some minimum and maximum. The delay can be relative to the previous task scheduling/execution/completion.- Since:
- 3.3.9
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classExponentialBackOffTrigger.DelayTypeHow the delay is calculated.
-
Constructor Summary
Constructors Constructor Description ExponentialBackOffTrigger(ExponentialBackOffTriggerProperties properties)Constructor with properties.ExponentialBackOffTrigger(ExponentialBackOffTrigger.DelayType delayType, long minDelay, long maxDelay, float factor)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.DatenextExecutionTime(org.springframework.scheduling.TriggerContext triggerContext)voidreset()Reset the delay to the minimum given at construction time.
-
-
-
Constructor Detail
-
ExponentialBackOffTrigger
public ExponentialBackOffTrigger(ExponentialBackOffTriggerProperties properties)
Constructor with properties. Loads all values during construction. I.e. does not respond to subsequent changes to property values dynamically.- Parameters:
properties- the properties
-
ExponentialBackOffTrigger
public ExponentialBackOffTrigger(ExponentialBackOffTrigger.DelayType delayType, long minDelay, long maxDelay, float factor)
Constructor.- Parameters:
delayType- type of delayminDelay- minimum delay in millisecondsmaxDelay- maximum delay in millisecondsfactor- multiplier factor to grow the delay- Throws:
java.lang.IllegalArgumentException- if the minimum delay is smaller than 1, the max delay is smaller than the minimum, or the factor is not positive.
-
-
Method Detail
-
nextExecutionTime
public java.util.Date nextExecutionTime(org.springframework.scheduling.TriggerContext triggerContext)
- Specified by:
nextExecutionTimein interfaceorg.springframework.scheduling.Trigger
-
reset
public void reset()
Reset the delay to the minimum given at construction time. Example usage: if the trigger is used to slow down attempt to contact a remote service in case of error, then a successful request can invoke reset, ensuring the next attempt will not be delayed.
-
-