--- jsr166/src/test/loops/PhaserLoops.java 2009/11/02 20:23:53 1.2 +++ jsr166/src/test/loops/PhaserLoops.java 2015/01/15 18:34:19 1.7 @@ -1,17 +1,16 @@ /* * 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.*; import java.util.concurrent.*; //import jsr166y.*; -/* +/** * Based loosely on Java Grande Forum barrierBench */ - public class PhaserLoops { static final int NCPUS = Runtime.getRuntime().availableProcessors(); static final ExecutorService pool = Executors.newCachedThreadPool(); @@ -31,11 +30,10 @@ public class PhaserLoops { phaser.register(); } - public void run() { int n = size; Phaser b = phaser; - for(int i = 0; i < n; ++i) + for (int i = 0; i < n; ++i) b.arriveAndAwaitAdvance(); } } @@ -57,7 +55,7 @@ public class PhaserLoops { actions[i] = new PhaserAction(i, phaser, size); } - Future[] futures = new Future[k]; + Future[] futures = new Future[k]; for (int i = 0; i < k; ++i) { futures[i] = pool.submit(actions[i]); }