Package org.jboss.modcluster.load.impl
Class DynamicLoadBalanceFactorProvider
- java.lang.Object
-
- org.jboss.modcluster.load.impl.DynamicLoadBalanceFactorProvider
-
- All Implemented Interfaces:
DynamicLoadBalanceFactorProviderMBean
,LoadBalanceFactorProvider
public class DynamicLoadBalanceFactorProvider extends Object implements LoadBalanceFactorProvider, DynamicLoadBalanceFactorProviderMBean
LoadBalanceFactorProvider
implementation that periodically aggregates load from a set ofLoadMetric
s.- Author:
- Paul Ferraro, Radoslav Husar
-
-
Field Summary
Fields Modifier and Type Field Description static float
DEFAULT_DECAY_FACTOR
static int
DEFAULT_HISTORY
static int
DEFAULT_INITIAL_LOAD
-
Constructor Summary
Constructors Constructor Description DynamicLoadBalanceFactorProvider(Set<LoadMetric> metrics)
DynamicLoadBalanceFactorProvider(Set<LoadMetric> metrics, int initialLoad)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description float
getDecayFactor()
Returns the exponential decay factor.int
getHistory()
Returns the history count.int
getLoadBalanceFactor(Engine engine)
Map<String,Double>
getMetrics()
Returns the load metrics registered with this providervoid
setDecayFactor(float decayFactor)
Sets the exponential decay factor to be applied to historical load values.void
setHistory(int history)
Sets the number of historical load values to consider when calculating the load balance factor.
-
-
-
Field Detail
-
DEFAULT_INITIAL_LOAD
public static final int DEFAULT_INITIAL_LOAD
- See Also:
- Constant Field Values
-
DEFAULT_DECAY_FACTOR
public static final float DEFAULT_DECAY_FACTOR
- See Also:
- Constant Field Values
-
DEFAULT_HISTORY
public static final int DEFAULT_HISTORY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DynamicLoadBalanceFactorProvider
public DynamicLoadBalanceFactorProvider(Set<LoadMetric> metrics)
-
DynamicLoadBalanceFactorProvider
public DynamicLoadBalanceFactorProvider(Set<LoadMetric> metrics, int initialLoad)
-
-
Method Detail
-
getMetrics
public Map<String,Double> getMetrics()
Description copied from interface:DynamicLoadBalanceFactorProviderMBean
Returns the load metrics registered with this provider- Specified by:
getMetrics
in interfaceDynamicLoadBalanceFactorProviderMBean
- Returns:
- a collection of load metrics
-
getLoadBalanceFactor
public int getLoadBalanceFactor(Engine engine)
- Specified by:
getLoadBalanceFactor
in interfaceLoadBalanceFactorProvider
-
getDecayFactor
public float getDecayFactor()
Description copied from interface:DynamicLoadBalanceFactorProviderMBean
Returns the exponential decay factor.- Specified by:
getDecayFactor
in interfaceDynamicLoadBalanceFactorProviderMBean
- Returns:
- a positive integer
-
setDecayFactor
public void setDecayFactor(float decayFactor)
Description copied from interface:DynamicLoadBalanceFactorProviderMBean
Sets the exponential decay factor to be applied to historical load values.- Specified by:
setDecayFactor
in interfaceDynamicLoadBalanceFactorProviderMBean
- Parameters:
decayFactor
- the new decay factor
-
getHistory
public int getHistory()
Description copied from interface:DynamicLoadBalanceFactorProviderMBean
Returns the history count.- Specified by:
getHistory
in interfaceDynamicLoadBalanceFactorProviderMBean
- Returns:
- a positive integer
-
setHistory
public void setHistory(int history)
Description copied from interface:DynamicLoadBalanceFactorProviderMBean
Sets the number of historical load values to consider when calculating the load balance factor.- Specified by:
setHistory
in interfaceDynamicLoadBalanceFactorProviderMBean
-
-