--- jsr166/src/test/loops/ExecutorCompletionServiceLoops.java 2007/02/19 00:46:06 1.2 +++ jsr166/src/test/loops/ExecutorCompletionServiceLoops.java 2009/10/29 23:09:07 1.3 @@ -8,9 +8,9 @@ import java.util.concurrent.*; public class ExecutorCompletionServiceLoops { static final int POOLSIZE = 100; - static final ExecutorService pool = + static final ExecutorService pool = Executors.newFixedThreadPool(POOLSIZE); - static final ExecutorCompletionService ecs = + static final ExecutorCompletionService ecs = new ExecutorCompletionService(pool); static boolean print = false; @@ -18,14 +18,14 @@ public class ExecutorCompletionServiceLo int max = 8; int base = 10000; - if (args.length > 0) + if (args.length > 0) max = Integer.parseInt(args[0]); System.out.println("Warmup..."); oneTest( base ); Thread.sleep(100); print = true; - + for (int i = 1; i <= max; i += (i+1) >>> 1) { System.out.print("n: " + i * base); oneTest(i * base ); @@ -33,7 +33,7 @@ public class ExecutorCompletionServiceLo } pool.shutdown(); } - + static class Task implements Callable { public Integer call() { int l = System.identityHashCode(this); @@ -48,9 +48,9 @@ public class ExecutorCompletionServiceLo static class Producer implements Runnable { final ExecutorCompletionService cs; final int iters; - Producer(ExecutorCompletionService ecs, int i) { + Producer(ExecutorCompletionService ecs, int i) { cs = ecs; - iters = i; + iters = i; } public void run() { for (int i = 0; i < iters; ++i)