--- jsr166/src/test/loops/ConcurrentQueueLoops.java 2009/11/03 01:04:02 1.10 +++ jsr166/src/test/loops/ConcurrentQueueLoops.java 2014/12/18 18:43:22 1.16 @@ -1,7 +1,7 @@ /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.*; @@ -21,7 +21,7 @@ public class ConcurrentQueueLoops { public static void main(String[] args) throws Exception { int maxStages = 100; int work = 1024; - Class klass = null; + Class klass = null; if (args.length > 0) { try { klass = Class.forName(args[0]); @@ -50,8 +50,7 @@ public class ConcurrentQueueLoops { Thread.sleep(100); print = true; - int k = 1; - for (int i = 1; i <= maxStages;) { + for (int k = 1, i = 1; i <= maxStages;) { oneRun(klass, i); if (i == k) { k = i << 1; @@ -61,13 +60,13 @@ public class ConcurrentQueueLoops { i = k; } pool.shutdown(); - } + } static final class Stage implements Callable { final Queue queue; final CyclicBarrier barrier; final int nthreads; - Stage (Queue q, CyclicBarrier b, int nthreads) { + Stage(Queue q, CyclicBarrier b, int nthreads) { queue = q; barrier = b; this.nthreads = nthreads; @@ -76,7 +75,7 @@ public class ConcurrentQueueLoops { static int compute(int l) { if (l == 0) return (int) System.nanoTime(); - int nn = (l >>> 7) & workMask; + int nn = (l >>> 7) & workMask; while (nn-- > 0) l = LoopHelpers.compute6(l); return l; @@ -117,7 +116,7 @@ public class ConcurrentQueueLoops { } } - static void oneRun(Class klass, int n) throws Exception { + static void oneRun(Class klass, int n) throws Exception { Queue q = (Queue) klass.newInstance(); LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); CyclicBarrier barrier = new CyclicBarrier(n + 1, timer);