public class DefaultElasticityManager extends Object implements com.bytex.snamp.supervision.elasticity.ElasticityManager, AutoCloseable
Real scaling logic should be implemented in the derived class.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
DefaultElasticityManager.ScalingDecision
Represents scaling decision.
|
| Constructor and Description |
|---|
DefaultElasticityManager()
Initializes a new elasticity manager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addScalingPolicy(String policyName,
ScalingPolicy voter)
Adds a new voter to this manager.
|
void |
close() |
protected DefaultElasticityManager.ScalingDecision |
decide(ScalingPolicyEvaluationContext context,
Map<String,Double> ballotBox) |
double |
getCastingVoteWeight() |
Duration |
getCooldownTime() |
int |
getMaxClusterSize()
Gets maximum number of resources in cluster.
|
com.bytex.snamp.connector.metrics.Metric |
getMetric(String metricName)
Gets metric by its name.
|
<M extends com.bytex.snamp.connector.metrics.Metric> |
getMetrics(Class<M> metricType)
Returns a set of supported metrics.
|
int |
getMinClusterSize()
Gets minimum number of resources in cluster.
|
com.google.common.collect.ImmutableMap<String,ScalingPolicy> |
getPolicies()
Gets read-only map of active scaling policies.
|
com.bytex.snamp.supervision.elasticity.ScalingMetrics |
getScalingMetrics()
Gets scaling metrics.
|
int |
getScalingSize() |
double |
getVotesForScaleIn() |
double |
getVotesForScaleOut() |
Iterator<com.bytex.snamp.connector.metrics.Metric> |
iterator()
Returns an iterator over elements of type
T. |
void |
reset()
Resets internal state of the object.
|
void |
setCooldownTime(Duration value) |
void |
setMaxClusterSize(int value)
Sets maximum size of a cluster.
|
void |
setMinClusterSize(int value)
Sets minimum size of a cluster.
|
void |
setScalingSize(int value) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic DefaultElasticityManager()
public final void addScalingPolicy(@Nonnull String policyName, @Nonnull ScalingPolicy voter)
policyName - Name of the policy.voter - A voter that will be used to compute decision about scaling.protected final DefaultElasticityManager.ScalingDecision decide(@Nonnull ScalingPolicyEvaluationContext context, @Nullable Map<String,Double> ballotBox)
public final void setMaxClusterSize(int value)
value - Maximum size of a cluster. Cannot be less than 1.public final void setMinClusterSize(int value)
value - Minimum size of a cluster.public final int getMaxClusterSize()
getMaxClusterSize in interface com.bytex.snamp.supervision.elasticity.ElasticityManagerpublic final int getMinClusterSize()
getMinClusterSize in interface com.bytex.snamp.supervision.elasticity.ElasticityManager@Nonnull public final Duration getCooldownTime()
getCooldownTime in interface com.bytex.snamp.supervision.elasticity.ElasticityManagerpublic final void setScalingSize(int value)
public final int getScalingSize()
getScalingSize in interface com.bytex.snamp.supervision.elasticity.ElasticityManagerpublic final double getCastingVoteWeight()
getCastingVoteWeight in interface com.bytex.snamp.supervision.elasticity.ElasticityManagerpublic final com.bytex.snamp.supervision.elasticity.ScalingMetrics getScalingMetrics()
getScalingMetrics in interface com.bytex.snamp.supervision.elasticity.ElasticityManagerpublic <M extends com.bytex.snamp.connector.metrics.Metric> Iterable<? extends M> getMetrics(Class<M> metricType)
getMetrics in interface com.bytex.snamp.connector.metrics.MetricsSupportmetricType - Type of the metrics.public com.bytex.snamp.connector.metrics.Metric getMetric(String metricName)
getMetric in interface com.bytex.snamp.connector.metrics.MetricsSupportmetricName - Name of the metric.@Nonnull public Iterator<com.bytex.snamp.connector.metrics.Metric> iterator()
T.public void reset()
reset in interface com.bytex.snamp.connector.metrics.MetricsSupportreset in interface com.bytex.snamp.Statefulpublic final double getVotesForScaleIn()
getVotesForScaleIn in interface com.bytex.snamp.supervision.elasticity.ElasticityManagerpublic double getVotesForScaleOut()
getVotesForScaleOut in interface com.bytex.snamp.supervision.elasticity.ElasticityManagerpublic final com.google.common.collect.ImmutableMap<String,ScalingPolicy> getPolicies()
getPolicies in interface com.bytex.snamp.supervision.elasticity.ElasticityManager@OverridingMethodsMustInvokeSuper public void close() throws Exception
close in interface AutoCloseableExceptionCopyright © 2015–2017 Bytex Solutions. All rights reserved.