public abstract static class StochasticLoadBalancer.CostFunction extends Object
Modifier and Type | Field and Description |
---|---|
protected BaseLoadBalancer.Cluster |
cluster |
private float |
multiplier |
Constructor and Description |
---|
CostFunction(org.apache.hadoop.conf.Configuration c) |
Modifier and Type | Method and Description |
---|---|
protected abstract double |
cost() |
protected double |
costFromArray(double[] stats) |
(package private) float |
getMultiplier() |
private double |
getSum(double[] stats) |
(package private) void |
init(BaseLoadBalancer.Cluster cluster)
Called once per LB invocation to give the cost function
to initialize it's state, and perform any costly calculation.
|
(package private) boolean |
isNeeded() |
(package private) void |
postAction(BaseLoadBalancer.Cluster.Action action)
Called once per cluster Action to give the cost function
an opportunity to update it's state.
|
protected void |
regionMoved(int region,
int oldServer,
int newServer) |
protected double |
scale(double min,
double max,
double value)
Scale the value between 0 and 1.
|
(package private) void |
setMultiplier(float m) |
private float multiplier
protected BaseLoadBalancer.Cluster cluster
public CostFunction(org.apache.hadoop.conf.Configuration c)
boolean isNeeded()
float getMultiplier()
void setMultiplier(float m)
void init(BaseLoadBalancer.Cluster cluster)
void postAction(BaseLoadBalancer.Cluster.Action action)
protected void regionMoved(int region, int oldServer, int newServer)
protected abstract double cost()
protected double costFromArray(double[] stats)
private double getSum(double[] stats)
protected double scale(double min, double max, double value)
min
- Min valuemax
- The Max valuevalue
- The value to be scaled.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.