Class LoadingFactor

    • 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)