[jboss-cvs] JBoss Messaging SVN: r3849 - branches/Branch_Stable/src/main/org/jboss/jms/server/messagecounter.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Mar 6 10:20:14 EST 2008
Author: jmesnil
Date: 2008-03-06 10:20:14 -0500 (Thu, 06 Mar 2008)
New Revision: 3849
Modified:
branches/Branch_Stable/src/main/org/jboss/jms/server/messagecounter/MessageCounter.java
Log:
* JBMESSAGING-1237: Daily counters increment on timer regardless of whether and messages are sent
- in MessageCounter.updateHistory(), increment the counter for the latest hour by the number of new messages (since latest update) instead of 1
Modified: branches/Branch_Stable/src/main/org/jboss/jms/server/messagecounter/MessageCounter.java
===================================================================
--- branches/Branch_Stable/src/main/org/jboss/jms/server/messagecounter/MessageCounter.java 2008-03-06 09:47:20 UTC (rev 3848)
+++ branches/Branch_Stable/src/main/org/jboss/jms/server/messagecounter/MessageCounter.java 2008-03-06 15:20:14 UTC (rev 3849)
@@ -162,7 +162,7 @@
timeLastUpdate = System.currentTimeMillis();
// update message history
- updateHistory(true);
+ updateHistory(newMessagesAdded);
}
/**
@@ -402,8 +402,10 @@
/**
* Update message counter history
+ *
+ * @param newMessages number of new messages to add to the latest day counter
*/
- private void updateHistory(boolean incrementCounter)
+ private void updateHistory(int newMessages)
{
// check history activation
if (dayCounter.isEmpty())
@@ -469,7 +471,7 @@
// update last day counter entry
counterLast = (DayCounter) dayCounter.get(dayCounter.size() - 1);
- counterLast.updateDayCounter(incrementCounter);
+ counterLast.updateDayCounter(newMessages);
}
}
@@ -501,7 +503,7 @@
String ret = "";
// ensure history counters are up to date
- updateHistory(false);
+ updateHistory(0);
// compile string
synchronized (dayCounter)
@@ -579,9 +581,9 @@
/**
* Update day counter hour array elements
*
- * @param incrementCounter update current hour counter
+ * @param newMessages number of new messages since the counter was last updated.
*/
- void updateDayCounter(boolean incrementCounter)
+ void updateDayCounter(int newMessages)
{
// get the current hour of the day
GregorianCalendar cal = new GregorianCalendar();
@@ -609,11 +611,8 @@
}
}
- // optionally increment current counter
- if (incrementCounter)
- {
- counters[currentIndex]++;
- }
+ // increment current counter with the new messages
+ counters[currentIndex] += newMessages;
}
/**
More information about the jboss-cvs-commits
mailing list