org.objectweb.joram.mom.dest
Class LoadingFactor

java.lang.Object
  extended by org.objectweb.joram.mom.dest.LoadingFactor
All Implemented Interfaces:
java.io.Serializable

public class LoadingFactor
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Nested Class Summary
static class LoadingFactor.ConsumerStatus
           
static class LoadingFactor.ProducerStatus
           
static class LoadingFactor.Status
           
 
Field Summary
 boolean autoEvalThreshold
          automatic eval threshold
 ClusterQueueImpl clusterQueueImpl
          reference to clusterQueueImpl
private  int consumerStatus
          consumer status
 int consumThreshold
          consumer threshold
static org.objectweb.util.monolog.api.Logger logger
          logger
private  int nbOfPendingMessages
           
private  int nbOfPendingRequests
           
private  boolean overLoaded
           
private  int producerStatus
          producer status
 int producThreshold
          producer threshold
private  float rateOfFlow
           
private static long serialVersionUID
          define serialVersionUID for interoperability
private  int status
          status
private  long statusTime
          status time
 long validityPeriod
          validity period
 
Constructor Summary
LoadingFactor(ClusterQueueImpl clusterQueueImpl, int producThreshold, int consumThreshold, boolean autoEvalThreshold, long validityPeriod)
           
 
Method Summary
private  void dispatchAndSendTo(java.util.Hashtable clusters, int nbOfPendingMessages, int nbOfPendingRequests)
          use to dispatch request hope or give messages in clusters.
private  void evalActivity()
          this method eval the activity of consumer and producer.
 float evalRateOfFlow(int pendingMessages, int pendingRequests)
          Evaluates the average rate of flow.
 void factorCheck(java.util.Hashtable clusters, int pendingMessages, int pendingRequests)
          This method evaluates the rate of flow and activity.
 float getRateOfFlow()
           
 boolean isOverloaded()
          true if cluster queue is overloaded.
private  void processGive(int nbMsgGive, java.util.Hashtable clusters)
          send nb messages on clusters.
private  void processHope(int nbMsgHope, java.util.Hashtable clusters)
          send a hope request on a cluster queue.
 void setRateOfFlow(float rateOfFlow)
           
 void setWait()
           
 java.lang.String toString()
           
private  void updateThreshold()
          update the threshold if autoEvalThreshold is true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
define serialVersionUID for interoperability

See Also:
Constant Field Values

logger

public static org.objectweb.util.monolog.api.Logger logger
logger


status

private int status
status


statusTime

private long statusTime
status time


consumerStatus

private int consumerStatus
consumer status


producerStatus

private int producerStatus
producer status


clusterQueueImpl

public ClusterQueueImpl clusterQueueImpl
reference to clusterQueueImpl


producThreshold

public int producThreshold
producer threshold


consumThreshold

public int consumThreshold
consumer threshold


autoEvalThreshold

public boolean autoEvalThreshold
automatic eval threshold


validityPeriod

public long validityPeriod
validity period


rateOfFlow

private float rateOfFlow

overLoaded

private boolean overLoaded

nbOfPendingMessages

private int nbOfPendingMessages

nbOfPendingRequests

private int nbOfPendingRequests
Constructor Detail

LoadingFactor

public LoadingFactor(ClusterQueueImpl clusterQueueImpl,
                     int producThreshold,
                     int consumThreshold,
                     boolean autoEvalThreshold,
                     long validityPeriod)
Method Detail

setRateOfFlow

public void setRateOfFlow(float rateOfFlow)

getRateOfFlow

public float getRateOfFlow()

setWait

public void setWait()

evalActivity

private void evalActivity()
this method eval the activity of consumer and producer.


updateThreshold

private void updateThreshold()
update the threshold if autoEvalThreshold is true.


evalRateOfFlow

public float evalRateOfFlow(int pendingMessages,
                            int pendingRequests)
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.
Returns:
the rate of flow

factorCheck

public void factorCheck(java.util.Hashtable clusters,
                        int pendingMessages,
                        int pendingRequests)
This method evaluates the rate of flow and activity. If necessary send "give" or "hope" messages, and update threshold.

Parameters:
clusters -
pendingMessages -
pendingRequests -

isOverloaded

public boolean isOverloaded()
true if cluster queue is overloaded. depends on activity.

Returns:
true if cluster queue is overloaded.

dispatchAndSendTo

private void dispatchAndSendTo(java.util.Hashtable clusters,
                               int nbOfPendingMessages,
                               int nbOfPendingRequests)
use to dispatch request hope or give messages in clusters.

Parameters:
clusters -
nbOfPendingMessages -
nbOfPendingRequests -

processGive

private void processGive(int nbMsgGive,
                         java.util.Hashtable clusters)
send nb messages on clusters.

Parameters:
nbMsgGive -
clusters - Hashtable of cluster Queue

processHope

private void processHope(int nbMsgHope,
                         java.util.Hashtable clusters)
send a hope request on a cluster queue.

Parameters:
nbMsgHope -
clusters - Hashtable of cluster Queue

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2010 ScalAgent D.T.. All Rights Reserved.