Class RuleBasedPredictorParams
- java.lang.Object
-
- com.elastisys.autoscaler.predictors.rulebased.config.RuleBasedPredictorParams
-
public class RuleBasedPredictorParams extends java.lang.ObjectRepresentsPredictorConfigparameters for aRuleBasedPredictor.
-
-
Field Summary
Fields Modifier and Type Field Description static com.elastisys.scale.commons.json.types.TimeIntervalDEFAULT_COOLDOWN_PERIOD
-
Constructor Summary
Constructors Constructor Description RuleBasedPredictorParams(com.elastisys.scale.commons.json.types.TimeInterval cooldownPeriod, java.util.List<ScalingRule> scalingRules)Constructs a newRuleBasedPredictor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)com.elastisys.scale.commons.json.types.TimeIntervalgetCooldownPeriod()Returns the time period that theRuleBasedPredictorwill remain passive after a scaling rule has been triggered, in order to allow changes to have a chance to take effect before another scaling rule is triggered.java.util.List<ScalingRule>getScalingRules()Returns the collection ofScalingRules to be enforced.inthashCode()static RuleBasedPredictorParamsparse(com.google.gson.JsonElement jsonConfig)Factory method that parses out anRuleBasedPredictorParamsfrom a JSON representation, or fails with aJsonSyntaxException.java.lang.StringtoString()voidvalidate()Performs basic validation of thisRuleBasedPredictorParams.
-
-
-
Constructor Detail
-
RuleBasedPredictorParams
public RuleBasedPredictorParams(com.elastisys.scale.commons.json.types.TimeInterval cooldownPeriod, java.util.List<ScalingRule> scalingRules)Constructs a newRuleBasedPredictor.- Parameters:
cooldownPeriod- The time period that theRuleBasedPredictorwill remain passive after a scaling rule has been triggered, in order to allow changes to have a chance to take effect before another scaling rule is triggered. May benull. Default isDEFAULT_COOLDOWN_PERIOD.scalingRules- The collection ofScalingRules to be enforced. TheScalingRules are evaluated in order by theRuleBasedPredictor. During a prediction iteration, the firstScalingRuleto be satisfied is triggered (the rest are ignored) and marks the start of a cooldown period. May benull, which is equivalent to giving an empty list.
-
-
Method Detail
-
parse
public static RuleBasedPredictorParams parse(com.google.gson.JsonElement jsonConfig)
Factory method that parses out anRuleBasedPredictorParamsfrom a JSON representation, or fails with aJsonSyntaxException.- Parameters:
jsonConfig- The JSON representation of theRuleBasedPredictorParams.- Returns:
- The parsed
RuleBasedPredictorParams.
-
validate
public void validate() throws java.lang.IllegalArgumentExceptionPerforms basic validation of thisRuleBasedPredictorParams.- Throws:
java.lang.IllegalArgumentException- if validation fails.
-
getCooldownPeriod
public com.elastisys.scale.commons.json.types.TimeInterval getCooldownPeriod()
Returns the time period that theRuleBasedPredictorwill remain passive after a scaling rule has been triggered, in order to allow changes to have a chance to take effect before another scaling rule is triggered.- Returns:
-
getScalingRules
public java.util.List<ScalingRule> getScalingRules()
Returns the collection ofScalingRules to be enforced. TheScalingRules are evaluated in order by theRuleBasedPredictor. During a prediction iteration, the firstScalingRuleto be satisfied is triggered (the rest are ignored) and marks the start of a cooldown period.- Returns:
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-