Package org.objectweb.joram.mom.dest
Class LoadingFactor
- java.lang.Object
-
- org.objectweb.joram.mom.dest.LoadingFactor
-
- All Implemented Interfaces:
Serializable
public class LoadingFactor extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLoadingFactor.ConsumerStatusstatic classLoadingFactor.ProducerStatusstatic classLoadingFactor.Status
-
Field Summary
Fields Modifier and Type Field Description protected booleanautoEvalThresholdautomatic eval thresholdprivate ClusterQueueclusterQueuereference to clusterQueueprivate intconsumerStatusconsumer statusprotected intconsumThresholdconsumer thresholdprivate static booleanDEBUG(package private) floatlastROFSentprivate static Loggerloggerloggerprivate intmaxFwdPerQueuemaximum number of messages forwarded to each queue of cluster by roundprivate intproducerStatusproducer statusprotected intproducThresholdproducer thresholdprivate floatrateOfFlowprivate static longserialVersionUIDdefine serialVersionUID for interoperabilityprivate intstatusstatusprivate longstatusTimestatus timeprotected longvalidityPeriodvalidity period
-
Constructor Summary
Constructors Constructor Description LoadingFactor(ClusterQueue clusterQueue, int producThreshold, int consumThreshold, boolean autoEvalThreshold, long validityPeriod, int maxFwdPerQueue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private intdispatchAndSendTo(Map clusters, int nbOfPendingMessages, int nbOfPendingRequests, int cload, int pload)use to dispatch request hope or give messages in clusters.voiddispatchLifeCycle(Map clusters)voidevalRateOfFlow(int pendingMessages, int pendingRequests, int cload, int pload)Evaluates the average rate of flow.intfactorCheck(Map clusters, int pendingMessages, int pendingRequests, int cload, int pload)This method evaluates the rate of flow and activity.StringgetConsumerStatus()StringgetProducerStatus()floatgetRateOfFlow()StringgetStatus()private intprocessGive(int nbMsgGive, Map clusters)send nb messages on clusters.private voidprocessHope(int nbMsgHope, Map clusters)send a hope request on a cluster queue.voidsetRateOfFlow(float rateOfFlow)voidsetWait()StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
define serialVersionUID for interoperability- See Also:
- Constant Field Values
-
logger
private static final Logger logger
logger
-
DEBUG
private static final boolean DEBUG
-
status
private int status
status
-
statusTime
private long statusTime
status time
-
consumerStatus
private int consumerStatus
consumer status
-
producerStatus
private int producerStatus
producer status
-
clusterQueue
private ClusterQueue clusterQueue
reference to clusterQueue
-
producThreshold
protected int producThreshold
producer threshold
-
consumThreshold
protected int consumThreshold
consumer threshold
-
autoEvalThreshold
protected boolean autoEvalThreshold
automatic eval threshold
-
validityPeriod
protected long validityPeriod
validity period
-
maxFwdPerQueue
private int maxFwdPerQueue
maximum number of messages forwarded to each queue of cluster by round
-
rateOfFlow
private float rateOfFlow
-
lastROFSent
float lastROFSent
-
-
Constructor Detail
-
LoadingFactor
public LoadingFactor(ClusterQueue clusterQueue, int producThreshold, int consumThreshold, boolean autoEvalThreshold, long validityPeriod, int maxFwdPerQueue)
-
-
Method Detail
-
setRateOfFlow
public void setRateOfFlow(float rateOfFlow)
-
getRateOfFlow
public float getRateOfFlow()
-
getStatus
public String getStatus()
-
getProducerStatus
public String getProducerStatus()
-
getConsumerStatus
public String getConsumerStatus()
-
setWait
public void setWait()
-
evalRateOfFlow
public void evalRateOfFlow(int pendingMessages, int pendingRequests, int cload, int pload)Evaluates the average rate of flow. If rateOfFlow is greater than 1 the queue are more pending requests than pending messages else if rateOfFlow is lower than 1 the queue are more pending messages than pending requests. This value is set in all QueueClusterNot notification.- Parameters:
pendingMessages- the number of pending messages.pendingRequests- the number of pending requests.cload- consumer load.pload- producer load.
-
factorCheck
public int factorCheck(Map clusters, int pendingMessages, int pendingRequests, int cload, int pload)
This method evaluates the rate of flow and activity. If necessary send "give" or "hope" messages, and update threshold.- Parameters:
clusters-pendingMessages-pendingRequests-
-
dispatchAndSendTo
private int dispatchAndSendTo(Map clusters, int nbOfPendingMessages, int nbOfPendingRequests, int cload, int pload)
use to dispatch request hope or give messages in clusters.- Parameters:
clusters-nbOfPendingMessages-nbOfPendingRequests-
-
processGive
private int processGive(int nbMsgGive, Map clusters)send nb messages on clusters.- Parameters:
nbMsgGive-clusters- Map of cluster Queue
-
processHope
private void processHope(int nbMsgHope, Map clusters)send a hope request on a cluster queue.- Parameters:
nbMsgHope-clusters- Map of cluster Queue
-
dispatchLifeCycle
public void dispatchLifeCycle(Map clusters)
-
-