Author: toad
Date: 2006-10-05 18:44:26 +0000 (Thu, 05 Oct 2006)
New Revision: 10614

Modified:
   trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java
Log:
Synchronize before doing System.currentTimeMillis(), to ensure serialization.

Modified: trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java
===================================================================
--- trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java      
2006-10-05 17:40:42 UTC (rev 10613)
+++ trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java      
2006-10-05 18:44:26 UTC (rev 10614)
@@ -138,8 +138,9 @@
     }

        public void report(double d) {
-               long now = System.currentTimeMillis();
                synchronized(this) {
+                       // Must synchronize first to achieve serialization.
+                       long now = System.currentTimeMillis();
                        if(d < minReport) {
                                Logger.error(this, "Impossible: "+d+" on 
"+this, new Exception("error"));
                                return;


Reply via email to