113 |
|
checkCompletedNormally(a, null); |
114 |
|
} |
115 |
|
|
116 |
< |
<T> void checkCompletedNormally(ForkJoinTask<T> a, T expected) { |
116 |
> |
<T> void checkCompletedNormally(ForkJoinTask<T> a, T expectedValue) { |
117 |
|
assertTrue(a.isDone()); |
118 |
|
assertFalse(a.isCancelled()); |
119 |
|
assertTrue(a.isCompletedNormally()); |
120 |
|
assertFalse(a.isCompletedAbnormally()); |
121 |
|
assertNull(a.getException()); |
122 |
< |
assertSame(expected, a.getRawResult()); |
122 |
> |
assertSame(expectedValue, a.getRawResult()); |
123 |
|
if (a instanceof BinaryAsyncAction) |
124 |
|
assertEquals(COMPLETE_STATE, |
125 |
|
((BinaryAsyncAction)a).getForkJoinTaskTag()); |
127 |
|
{ |
128 |
|
Thread.currentThread().interrupt(); |
129 |
|
long startTime = System.nanoTime(); |
130 |
< |
assertSame(expected, a.join()); |
130 |
> |
assertSame(expectedValue, a.join()); |
131 |
|
assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); |
132 |
|
Thread.interrupted(); |
133 |
|
} |
142 |
|
|
143 |
|
assertFalse(a.cancel(false)); |
144 |
|
assertFalse(a.cancel(true)); |
145 |
+ |
|
146 |
+ |
T v1 = null, v2 = null; |
147 |
|
try { |
148 |
< |
assertSame(expected, a.get()); |
149 |
< |
assertSame(expected, a.get(randomTimeout(), randomTimeUnit())); |
150 |
< |
} catch (Exception fail) { threadUnexpectedException(fail); } |
148 |
> |
v1 = a.get(); |
149 |
> |
v2 = a.get(randomTimeout(), randomTimeUnit()); |
150 |
> |
} catch (Throwable fail) { threadUnexpectedException(fail); } |
151 |
> |
assertSame(expectedValue, v1); |
152 |
> |
assertSame(expectedValue, v2); |
153 |
|
} |
154 |
|
|
155 |
|
void checkCompletedAbnormally(ForkJoinTask a, Throwable t) { |