public abstract class AbstractDemandProfile
extends java.lang.Object
createDemandProfile(JSONObject)
that reflectively creates an
instance of this class from a JSONObject will fail.
(2) X must have a constructor that takes a single String as an
argument. Otherwise, the static method
createDemandProfile(String)
that reflectively creates an
instance of this class from a JSONObject will fail.
(3) For any instance x of X, x.equals(new X(x.getStats()) must return
true.
(4) It is slightly more efficient (but not necessary) for X to
override the methods createDemandProfile(String)
and
createDemandProfile(JSONObject)
method to create an instance
of X rather than having the default implementation do so via
reflection.
Refer to reconfiguration.reconfigurationutils.DemandProfile for an
example implementation.
Use ReconfigurationPolicyTest.testPolicyImplementation(Class)
to test an implementation of this class.Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractDemandProfile.Keys |
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
name |
Constructor and Description |
---|
AbstractDemandProfile(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
AbstractDemandProfile |
clone()
Deprecated.
|
abstract void |
combine(AbstractDemandProfile update)
Combine the new information in
update into this . |
protected static AbstractDemandProfile |
createDemandProfile(java.lang.Class<?> clazz,
java.lang.String name) |
static AbstractDemandProfile |
createDemandProfile(org.json.JSONObject json) |
protected static AbstractDemandProfile |
createDemandProfile(java.lang.String name) |
abstract org.json.JSONObject |
getDemandStats()
All relevant stats must be serializable into JSONObject.
|
java.lang.String |
getName() |
abstract void |
justReconfigured()
Tells
this that the current demand profile was just used to
perform reconfiguration. |
abstract java.util.Set<java.lang.String> |
reconfigure(java.util.Set<java.lang.String> curActives,
ReconfigurableAppInfo appInfo)
The main reconfiguration policy invoked at reconfigurators (not active
replicas).
|
void |
reset()
Deprecated.
|
abstract boolean |
shouldReportDemandStats(Request request,
java.net.InetAddress sender,
ReconfigurableAppInfo nodeConfig)
This method incorporates new information about client requests, i.e.,
request was received from sender . |
public AbstractDemandProfile(java.lang.String name)
name
- The service name of the reconfiguree replica group.public abstract boolean shouldReportDemandStats(Request request, java.net.InetAddress sender, ReconfigurableAppInfo nodeConfig)
request
was received from sender
. The list of all active
replicas can be obtained from
ReconfigurableAppInfo.getAllActiveReplicas()
; this may be useful
to determine whether other active replicas might be better suited to
service requests from this sender.
This method must implement a policy that tells whether it is time to
report from an active replica to a reconfigurator. Active replicas in
general should not report upon every request, but at some coarser
frequency to limit overhead.request
- sender
- nodeConfig
- public abstract org.json.JSONObject getDemandStats()
reconfigure(Set, ReconfigurableAppInfo)
that is invoked at reconfigurators (not active replicas).public abstract void combine(AbstractDemandProfile update)
update
into this
. This
method is used at reconfigurators to combine a newly received demand
report with an existing demand report.update
- public abstract java.util.Set<java.lang.String> reconfigure(java.util.Set<java.lang.String> curActives, ReconfigurableAppInfo appInfo)
curActives
- nodeConfig
- ReconfigurationConfig.RC.RECONFIGURE_IN_PLACE
is set to false.public abstract void justReconfigured()
this
that the current demand profile was just used to
perform reconfiguration. This information is useful for implementing
policies based on the difference between the current demand profile and
the one at the time of the most recent reconfiguration, e.g., reconfigure
only if the demand from some region has changed by more than 10%.public final java.lang.String getName()
@Deprecated public AbstractDemandProfile clone()
Map
, then a new Map has to be created inside the clone() method.clone
in class java.lang.Object
@Deprecated public void reset()
protected static AbstractDemandProfile createDemandProfile(java.lang.String name)
protected static AbstractDemandProfile createDemandProfile(java.lang.Class<?> clazz, java.lang.String name)
public static AbstractDemandProfile createDemandProfile(org.json.JSONObject json)
json
-