public class AllLaunchConstrainer extends java.lang.Object implements LaunchConstrainer
LaunchConstrainer combinator that ensures that all the given constrainers are satisfied before launching a
task. Useful to create policies that need to limit launches to a certain rate, and when it's an off-peak time.
N.B. When determining whether a launch can happen, this object will short-circuit if any of its LaunchConstrainers reject the task.
| Constructor and Description |
|---|
AllLaunchConstrainer(LaunchConstrainer... constrainers) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canLaunch(RecoveryType recoveryType)
Determines whether the given
RecoveryType
can be launchHappened right now. |
void |
launchHappened(LaunchOfferRecommendation recommendation,
RecoveryType recoveryType)
Invoked every time a task is launchHappened.
|
public AllLaunchConstrainer(LaunchConstrainer... constrainers)
public 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 wait