--- jsr166/src/test/loops/OfferPollLoops.java 2009/10/29 23:09:07 1.2 +++ jsr166/src/test/loops/OfferPollLoops.java 2015/08/10 03:13:33 1.9 @@ -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.*; @@ -54,8 +54,7 @@ public class OfferPollLoops { warmup(); print = true; - int k = 1; - for (int i = 1; i <= maxN;) { + for (int k = 1, i = 1; i <= maxN;) { System.out.println("Pairs:" + i); oneTest(i, ITERS); if (i == k) { @@ -103,6 +102,11 @@ public class OfferPollLoops { Thread.sleep(100); // System.gc(); if (print) + System.out.print("ConcurrentLinkedDeque "); + oneRun(new ConcurrentLinkedDeque(), n, iters); + + Thread.sleep(100); // System.gc(); + if (print) System.out.print("LinkedBlockingQueue "); oneRun(new LinkedBlockingQueue(), n, iters); @@ -121,7 +125,6 @@ public class OfferPollLoops { System.out.print("ArrayBlockingQueue "); oneRun(new ArrayBlockingQueue(POOL_SIZE), n, iters); - Thread.sleep(100); // System.gc(); if (print) System.out.print("PriorityBlockingQueue "); @@ -131,16 +134,14 @@ public class OfferPollLoops { if (print) System.out.print("ArrayBlockingQueue(fair)"); oneRun(new ArrayBlockingQueue(POOL_SIZE, true), n, fairIters); - } - static abstract class Stage implements Runnable { + abstract static class Stage implements Runnable { final int iters; final Queue queue; final CyclicBarrier barrier; final Phaser lagPhaser; - Stage (Queue q, CyclicBarrier b, Phaser s, - int iters) { + Stage(Queue q, CyclicBarrier b, Phaser s, int iters) { queue = q; barrier = b; lagPhaser = s; @@ -233,5 +234,4 @@ public class OfferPollLoops { System.out.println("\t: " + LoopHelpers.rightJustify(time / (iters * n)) + " ns per transfer"); } - }