48 |
|
} |
49 |
|
|
50 |
|
private void testInvokeOnPool(ForkJoinPool pool, RecursiveAction a) { |
51 |
< |
try { |
51 |
> |
try (PoolCleaner cleaner = cleaner(pool)) { |
52 |
|
assertFalse(a.isDone()); |
53 |
|
assertFalse(a.isCompletedNormally()); |
54 |
|
assertFalse(a.isCompletedAbnormally()); |
64 |
|
assertFalse(a.isCancelled()); |
65 |
|
assertNull(a.getException()); |
66 |
|
assertNull(a.getRawResult()); |
67 |
– |
} finally { |
68 |
– |
joinPool(pool); |
67 |
|
} |
68 |
|
} |
69 |
|
|
96 |
|
|
97 |
|
{ |
98 |
|
Thread.currentThread().interrupt(); |
99 |
< |
long t0 = System.nanoTime(); |
99 |
> |
long startTime = System.nanoTime(); |
100 |
|
assertSame(expected, a.join()); |
101 |
< |
assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); |
101 |
> |
assertTrue(millisElapsedSince(startTime) < SMALL_DELAY_MS); |
102 |
|
Thread.interrupted(); |
103 |
|
} |
104 |
|
|
105 |
|
{ |
106 |
|
Thread.currentThread().interrupt(); |
107 |
< |
long t0 = System.nanoTime(); |
107 |
> |
long startTime = System.nanoTime(); |
108 |
|
a.quietlyJoin(); // should be no-op |
109 |
< |
assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); |
109 |
> |
assertTrue(millisElapsedSince(startTime) < SMALL_DELAY_MS); |
110 |
|
Thread.interrupted(); |
111 |
|
} |
112 |
|
|
139 |
|
Thread.interrupted(); |
140 |
|
|
141 |
|
{ |
142 |
< |
long t0 = System.nanoTime(); |
142 |
> |
long startTime = System.nanoTime(); |
143 |
|
a.quietlyJoin(); // should be no-op |
144 |
< |
assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); |
144 |
> |
assertTrue(millisElapsedSince(startTime) < SMALL_DELAY_MS); |
145 |
|
} |
146 |
|
|
147 |
|
try { |
177 |
|
Thread.interrupted(); |
178 |
|
|
179 |
|
{ |
180 |
< |
long t0 = System.nanoTime(); |
180 |
> |
long startTime = System.nanoTime(); |
181 |
|
a.quietlyJoin(); // should be no-op |
182 |
< |
assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); |
182 |
> |
assertTrue(millisElapsedSince(startTime) < SMALL_DELAY_MS); |
183 |
|
} |
184 |
|
|
185 |
|
try { |
216 |
|
AtomicIntegerFieldUpdater.newUpdater(BinaryAsyncAction.class, |
217 |
|
"controlState"); |
218 |
|
|
219 |
< |
private BinaryAsyncAction parent; |
219 |
> |
private volatile BinaryAsyncAction parent; |
220 |
|
|
221 |
< |
private BinaryAsyncAction sibling; |
221 |
> |
private volatile BinaryAsyncAction sibling; |
222 |
|
|
223 |
|
protected BinaryAsyncAction() { |
224 |
|
} |