public class AutoScalerPolicy extends AbstractPolicy
Resizable
entity and dynamically adjusts its size in response to
emitted POOL_COLD
and POOL_HOT
events. Alternatively, the policy can be configured to
keep a given metric within a required range.
TThis policy does not itself determine whether the pool is hot or cold, but instead relies on these
events being emitted by the monitored entity itself, or by another policy that is attached to it; see,
for example, LoadBalancingPolicy
.)
Modifier and Type | Class and Description |
---|---|
static class |
AutoScalerPolicy.Builder |
AbstractEntityAdjunct.AdjunctTagSupport
BrooklynObject.TagSupport
Configurable.ConfigurationSupport
BrooklynObjectInternal.ConfigurationSupportInternal
Constructor and Description |
---|
AutoScalerPolicy() |
AutoScalerPolicy(java.util.Map<java.lang.String,?> props) |
Modifier and Type | Method and Description |
---|---|
static AutoScalerPolicy.Builder |
builder() |
int |
getResizeDownIterationIncrement() |
int |
getResizeDownIterationMax() |
int |
getResizeUpIterationIncrement() |
int |
getResizeUpIterationMax() |
void |
init()
Called by framework (in new-style instances where spec was used) after configuring etc,
but before a reference to this instance is shared.
|
void |
rebind()
Called by framework on rebind (in new-style instances):
after configuring, but
before the instance is managed, and
before adjuncts are attached to entities, and
before a reference to an object is shared.
|
void |
resume()
Resume the policy
|
void |
setEntity(EntityLocal entity) |
void |
setMaxPoolSize(int val) |
void |
setMetricLowerBound(java.lang.Number val) |
void |
setMetricUpperBound(java.lang.Number val) |
void |
setMinPeriodBetweenExecs(Duration val) |
void |
setMinPeriodBetweenExecs(long val)
Deprecated.
since 0.7.0; use
setMinPeriodBetweenExecs(Duration) |
void |
setMinPoolSize(int val) |
void |
setResizeDownIterationIncrement(java.lang.Integer val) |
void |
setResizeDownIterationMax(java.lang.Integer val) |
void |
setResizeDownStabilizationDelay(Duration val) |
void |
setResizeDownStabilizationDelay(long val)
Deprecated.
since 0.7.0; use
setResizeDownStabilizationDelay(Duration) |
void |
setResizeUpIterationIncrement(java.lang.Integer val) |
void |
setResizeUpIterationMax(java.lang.Integer val) |
void |
setResizeUpStabilizationDelay(Duration val) |
void |
setResizeUpStabilizationDelay(long val)
Deprecated.
since 0.7.0; use
setResizeDownStabilizationDelay(Duration) |
void |
suspend()
Suspend the policy
|
java.lang.String |
toString() |
destroy, getPolicyType, getRebindSupport, isRunning, isSuspended
config, configure, getAllConfig, getConfig, getConfigMap, getDisplayName, getName, getUniqueTag, isDestroyed, setConfig, setDisplayName, setName, tags
getCatalogItemId, getId, getManagementContext, getTagSupport, setCatalogItemId, setManagementContext
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAllConfig, getConfig, getId, getName, setConfig
getUniqueTag, isDestroyed
getCatalogItemId, getDisplayName, getTagSupport, tags
config
setCatalogItemId
public static BasicNotificationSensor<java.util.Map> DEFAULT_POOL_HOT_SENSOR
public static BasicNotificationSensor<java.util.Map> DEFAULT_POOL_COLD_SENSOR
public static BasicNotificationSensor<java.util.Map> DEFAULT_POOL_OK_SENSOR
public static BasicNotificationSensor<MaxPoolSizeReachedEvent> DEFAULT_MAX_SIZE_REACHED_SENSOR
builder.maxSizeReachedSensor(sensor)
.
Note that this "default" is not set automatically; the default is for no sensor to be used (so
no events emitted).public static final java.lang.String POOL_CURRENT_SIZE_KEY
public static final java.lang.String POOL_HIGH_THRESHOLD_KEY
public static final java.lang.String POOL_LOW_THRESHOLD_KEY
public static final java.lang.String POOL_CURRENT_WORKRATE_KEY
public static final ConfigKey<AttributeSensor<? extends java.lang.Number>> METRIC
public static final ConfigKey<java.lang.Number> METRIC_LOWER_BOUND
public static final ConfigKey<java.lang.Number> METRIC_UPPER_BOUND
public static final ConfigKey<java.lang.Integer> RESIZE_UP_ITERATION_INCREMENT
public static final ConfigKey<java.lang.Integer> RESIZE_UP_ITERATION_MAX
public static final ConfigKey<java.lang.Integer> RESIZE_DOWN_ITERATION_INCREMENT
public static final ConfigKey<java.lang.Integer> RESIZE_DOWN_ITERATION_MAX
public static final ConfigKey<Duration> RESIZE_DOWN_STABILIZATION_DELAY
public static final ConfigKey<java.lang.Integer> MIN_POOL_SIZE
public static final ConfigKey<java.lang.Integer> MAX_POOL_SIZE
public static final ConfigKey<ResizeOperator> RESIZE_OPERATOR
public static final ConfigKey<com.google.common.base.Function<Entity,java.lang.Integer>> CURRENT_SIZE_OPERATOR
public static final ConfigKey<BasicNotificationSensor<? extends java.util.Map>> POOL_HOT_SENSOR
public static final ConfigKey<BasicNotificationSensor<? extends java.util.Map>> POOL_COLD_SENSOR
public static final ConfigKey<BasicNotificationSensor<? extends java.util.Map>> POOL_OK_SENSOR
public static final ConfigKey<BasicNotificationSensor<? super MaxPoolSizeReachedEvent>> MAX_SIZE_REACHED_SENSOR
public AutoScalerPolicy()
public AutoScalerPolicy(java.util.Map<java.lang.String,?> props)
public static AutoScalerPolicy.Builder builder()
public void init()
AbstractBrooklynObject
To preserve backwards compatibility for if the instance is constructed directly, one can call the code below, but that means it will be called after references to this policy have been shared with other entities.
if (isLegacyConstruction()) {
init();
}
init
in class AbstractBrooklynObject
public void rebind()
AbstractBrooklynObject
AbstractBrooklynObject.init()
will not be called on rebind.
If you need to intercept behaviour after adjuncts are attached,
consider AbstractEntity.onManagementStarting()
(but probably worth raising a discussion on the mailing list!)
rebind
in class AbstractBrooklynObject
public void setMetricLowerBound(java.lang.Number val)
public void setMetricUpperBound(java.lang.Number val)
public int getResizeUpIterationIncrement()
public void setResizeUpIterationIncrement(java.lang.Integer val)
public int getResizeDownIterationIncrement()
public void setResizeDownIterationIncrement(java.lang.Integer val)
public int getResizeUpIterationMax()
public void setResizeUpIterationMax(java.lang.Integer val)
public int getResizeDownIterationMax()
public void setResizeDownIterationMax(java.lang.Integer val)
public void setMinPeriodBetweenExecs(long val)
setMinPeriodBetweenExecs(Duration)
public void setMinPeriodBetweenExecs(Duration val)
public void setResizeUpStabilizationDelay(long val)
setResizeDownStabilizationDelay(Duration)
public void setResizeUpStabilizationDelay(Duration val)
public void setResizeDownStabilizationDelay(long val)
setResizeDownStabilizationDelay(Duration)
public void setResizeDownStabilizationDelay(Duration val)
public void setMinPoolSize(int val)
public void setMaxPoolSize(int val)
public void suspend()
Policy
suspend
in interface Policy
suspend
in class AbstractPolicy
public void resume()
Policy
resume
in interface Policy
resume
in class AbstractPolicy
public void setEntity(EntityLocal entity)
setEntity
in class AbstractEntityAdjunct
public java.lang.String toString()
toString
in class AbstractPolicy