changeset 1011:f481bc602a57

JMHSample_03_States: make the test more robust by contending over volatile fields.
author shade
date Sun, 21 Sep 2014 10:02:19 +0400
parents 2856725c3a81
children 5d05466092df
files jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_03_States.java
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_03_States.java	Mon Sep 15 13:41:10 2014 +0400
+++ b/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_03_States.java	Sun Sep 21 10:02:19 2014 +0400
@@ -52,12 +52,12 @@
 
     @State(Scope.Benchmark)
     public static class BenchmarkState {
-        double x = Math.PI;
+        volatile double x = Math.PI;
     }
 
     @State(Scope.Thread)
     public static class ThreadState {
-        double x = Math.PI;
+        volatile double x = Math.PI;
     }
 
     /*