ClusteredQueue q = (ClusteredQueue)bb.getQueue();    double newRate = q.getGrowthRate();  int newMessageCount = q.messageCount();  boolean sendStats = decideToSendStats(bb.getConsumptionRate(), newRate);  if (!sendStats) { sendStats = decideToSendStats(bb.getMessageCount(), newMessageCount);
if (bb.isActive()) { ClusteredQueue q = (ClusteredQueue)bb.getQueue();    double newRate = q.getGrowthRate();  int newMessageCount = q.messageCount();  boolean sendStats = decideToSendStats(bb.getConsumptionRate(), newRate);  if (!sendStats) { sendStats = decideToSendStats(bb.getMessageCount(), newMessageCount); }  if (sendStats) { bb.setConsumptionRate(newRate); bb.setMessageCount(newMessageCount);  if (stats == null) { stats = new ArrayList(); } QueueStats qs = new QueueStats(bb.getQueueName(), newRate, newMessageCount);  stats.add(qs); }
   public void sendStats() throws Exception   {      lock.writeLock().acquire();            List stats = null;                  try      {                  Map nameMap = (Map)nameMaps.get(nodeId);                  if (nameMap != null)         {                        Iterator iter = nameMap.values().iterator();                                 while (iter.hasNext())            {               ClusteredBinding bb = (ClusteredBinding)iter.next();                              ClusteredQueue q = (ClusteredQueue)bb.getQueue();                              //We don't bother sending the stat if there is less than STATS_DIFFERENCE_MARGIN_PERCENT % difference                              double newRate = q.getGrowthRate();                              int newMessageCount = q.messageCount();                              boolean sendStats = decideToSendStats(bb.getConsumptionRate(), newRate);                              if (!sendStats)               {                  sendStats = decideToSendStats(bb.getMessageCount(), newMessageCount);               }                              if (sendStats)               {                  bb.setConsumptionRate(newRate);                  bb.setMessageCount(newMessageCount);                                    if (stats == null)                  {                     stats = new ArrayList();                  }                  QueueStats qs = new QueueStats(bb.getQueueName(), newRate, newMessageCount);                                    stats.add(qs);               }                              }         }      }      finally      {         lock.writeLock().release();      }            if (stats != null)      {         ClusterRequest req = new QueueStatsRequest(nodeId, stats);                  asyncSendRequest(req);      }   }