public class TimedLaunchConstrainer extends java.lang.Object implements LaunchConstrainer
LaunchConstrainer that requires a minimum number of seconds to elapse between launches, for
rate-limiting purposes.| Constructor and Description |
|---|
TimedLaunchConstrainer(java.time.Duration minimumDelay)
Create a new constrainer with the given required minimum delay between permanent (destructive) recovery
operations.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canLaunch(RecoveryType recoveryType)
Determines whether the given
RecoveryType
can be launchHappened right now. |
protected long |
getCurrentTimeMs() |
void |
launchHappened(LaunchOfferRecommendation recommendation,
RecoveryType recoveryType)
Invoked every time a task is launchHappened.
|
public TimedLaunchConstrainer(java.time.Duration minimumDelay)
minimumDelay - Minimum delay between each destructive launchpublic void launchHappened(LaunchOfferRecommendation recommendation, RecoveryType recoveryType)
LaunchConstrainer
We take a Operation so that frameworks can specify additional metadata, in order to smooth the launch
rate.
launchHappened in interface LaunchConstrainerrecommendation - The OfferRecommendation containing the Launch Operation which occurredrecoveryType - The type of the recovery which has been executedpublic boolean canLaunch(RecoveryType recoveryType)
LaunchConstrainerRecoveryType
can be launchHappened right now.canLaunch in interface LaunchConstrainerrecoveryType - The RecoveryType to be examinedtrue if the offer is safe to launch immediately, false if it should waitprotected long getCurrentTimeMs()