Author: bstansberry(a)jboss.com
Date: 2009-03-25 22:58:00 -0400 (Wed, 25 Mar 2009)
New Revision: 2385
Modified:
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/client/ChartManager.java
Log:
Avoid division by zero
Modified:
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/client/ChartManager.java
===================================================================
---
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/client/ChartManager.java 2009-03-23
15:37:32 UTC (rev 2384)
+++
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/client/ChartManager.java 2009-03-26
02:58:00 UTC (rev 2385)
@@ -88,7 +88,10 @@
Integer xValue = new Integer(++seriesCount);
long now = System.currentTimeMillis();
- long elapsed = (now - lastUpdateTime) / 1000;
+ long elapsed = (now - lastUpdateTime) / 1000l;
+ if (elapsed == 0) // I once saw a DivideByZeroException below
+ return;
+
this.lastUpdateTime = now;
for (Map.Entry<String, AtomicInteger> entry : requestCounts.entrySet())