ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/ExecutorCompletionServiceLoops.java
(Generate patch)

Comparing jsr166/src/test/loops/ExecutorCompletionServiceLoops.java (file contents):
Revision 1.1 by dl, Mon May 2 19:19:38 2005 UTC vs.
Revision 1.3 by jsr166, Thu Oct 29 23:09:07 2009 UTC

# Line 1 | Line 1
1   /*
2 * @test %I% %E%
3 * @bug 166
4 * @compile -source 1.5 ExecutorCompletionServiceLoops.java
5 * @run main/timeout=3600 ExecutorCompletionServiceLoops
6 * @summary  Exercise ExecutorCompletionServiceLoops
7 */
8 /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3 < * Expert Group and released to the public domain. Use, modify, and
4 < * redistribute this code in any way without acknowledgement.
3 > * Expert Group and released to the public domain, as explained at
4 > * http://creativecommons.org/licenses/publicdomain
5   */
6  
7   import java.util.concurrent.*;
8  
9   public class ExecutorCompletionServiceLoops {
10      static final int POOLSIZE =      100;
11 <    static final ExecutorService pool =
11 >    static final ExecutorService pool =
12          Executors.newFixedThreadPool(POOLSIZE);
13 <    static final ExecutorCompletionService<Integer> ecs =
13 >    static final ExecutorCompletionService<Integer> ecs =
14          new ExecutorCompletionService<Integer>(pool);
15      static boolean print = false;
16  
# Line 25 | Line 18 | public class ExecutorCompletionServiceLo
18          int max = 8;
19          int base = 10000;
20  
21 <        if (args.length > 0)
21 >        if (args.length > 0)
22              max = Integer.parseInt(args[0]);
23  
24          System.out.println("Warmup...");
25          oneTest( base );
26          Thread.sleep(100);
27          print = true;
28 <        
28 >
29          for (int i = 1; i <= max; i += (i+1) >>> 1) {
30              System.out.print("n: " + i * base);
31              oneTest(i * base );
# Line 40 | Line 33 | public class ExecutorCompletionServiceLo
33          }
34          pool.shutdown();
35     }
36 <    
36 >
37      static class Task implements Callable<Integer> {
38          public Integer call() {
39              int l = System.identityHashCode(this);
# Line 55 | Line 48 | public class ExecutorCompletionServiceLo
48      static class Producer implements Runnable {
49          final ExecutorCompletionService cs;
50          final int iters;
51 <        Producer(ExecutorCompletionService ecs, int i) {
51 >        Producer(ExecutorCompletionService ecs, int i) {
52              cs = ecs;
53 <            iters = i;
53 >            iters = i;
54          }
55          public void run() {
56              for (int i = 0; i < iters; ++i)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines