Add volatiles as suggested by Tim to align code with AccessLogValve.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 18 Jun 2009 12:58:07 +0000 (12:58 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 18 Jun 2009 12:58:07 +0000 (12:58 +0000)
No significant change to results (on my machine at least ;)

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@786045 13f79535-47bb-0310-9956-ffa450edef68

test/org/apache/catalina/valves/Benchmarks.java

index ca76d62..1b4d5d5 100644 (file)
@@ -36,7 +36,7 @@ public class Benchmarks extends TestCase {
     }
 
     private static class GetDateBenchmarkTest extends BenchmarkTest {
-        private long currentMillis = 0;
+        private volatile long currentMillis = 0;
         private Date currentDate = null;
 
         private ThreadLocal<Long> currentMillisLocal = new ThreadLocal<Long>() {
@@ -78,8 +78,8 @@ public class Benchmarks extends TestCase {
     }
 
     private static class TimeDateElementBenchmarkTest extends BenchmarkTest {
-        private long currentMillis = 0;
-        private Date currentDate = null;
+        private volatile long currentMillis = 0;
+        private volatile Date currentDate = null;
         private String currentDateString = null;
         private SimpleDateFormat dayFormatter = new SimpleDateFormat("dd");
         private SimpleDateFormat monthFormatter = new SimpleDateFormat("MM");