1 |
|
/* |
2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
< |
* http://creativecommons.org/licenses/publicdomain |
4 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
import java.util.concurrent.*; |
7 |
|
|
32 |
|
Thread.sleep(100); |
33 |
|
} |
34 |
|
pool.shutdown(); |
35 |
< |
} |
35 |
> |
} |
36 |
|
|
37 |
|
static void oneRun(BlockingQueue<Integer> q, int npairs, int iters) throws Exception { |
38 |
|
LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer(); |
72 |
|
long endTime = System.nanoTime(); |
73 |
|
long time = endTime - timer.startTime; |
74 |
|
if (print) { |
75 |
< |
double secs = (double)(time) / 1000000000.0; |
75 |
> |
double secs = (double) time / 1000000000.0; |
76 |
|
System.out.println("\t " + secs + "s run time"); |
77 |
|
} |
78 |
|
} |
107 |
|
*/ |
108 |
|
} |
109 |
|
|
110 |
< |
static abstract class Stage implements Callable { |
110 |
> |
abstract static class Stage implements Callable { |
111 |
|
final BlockingQueue<Integer> queue; |
112 |
|
final CyclicBarrier barrier; |
113 |
|
final int iters; |
114 |
< |
Stage (BlockingQueue<Integer> q, CyclicBarrier b, int iters) { |
114 |
> |
Stage(BlockingQueue<Integer> q, CyclicBarrier b, int iters) { |
115 |
|
queue = q; |
116 |
|
barrier = b; |
117 |
|
this.iters = iters; |