134 |
|
assertFalse(a.isCancelled()); |
135 |
|
assertFalse(a.isCompletedNormally()); |
136 |
|
assertTrue(a.isCompletedAbnormally()); |
137 |
< |
assertSame(t, a.getException()); |
137 |
> |
assertSame(t.getClass(), a.getException().getClass()); |
138 |
|
assertNull(a.getRawResult()); |
139 |
|
assertFalse(a.cancel(false)); |
140 |
|
assertFalse(a.cancel(true)); |
143 |
|
a.join(); |
144 |
|
shouldThrow(); |
145 |
|
} catch (Throwable expected) { |
146 |
< |
assertSame(t, expected); |
146 |
> |
assertSame(expected.getClass(), t.getClass()); |
147 |
|
} |
148 |
|
|
149 |
|
try { |
150 |
|
a.get(); |
151 |
|
shouldThrow(); |
152 |
|
} catch (ExecutionException success) { |
153 |
< |
assertSame(t, success.getCause()); |
153 |
> |
assertSame(t.getClass(), success.getCause().getClass()); |
154 |
|
} catch (Throwable fail) { threadUnexpectedException(fail); } |
155 |
|
|
156 |
|
try { |
157 |
|
a.get(5L, SECONDS); |
158 |
|
shouldThrow(); |
159 |
|
} catch (ExecutionException success) { |
160 |
< |
assertSame(t, success.getCause()); |
160 |
> |
assertSame(t.getClass(), success.getCause().getClass()); |
161 |
|
} catch (Throwable fail) { threadUnexpectedException(fail); } |
162 |
|
} |
163 |
|
|
164 |
< |
static final class FJException extends RuntimeException { |
165 |
< |
FJException() { super(); } |
164 |
> |
public static final class FJException extends RuntimeException { |
165 |
> |
public FJException() { super(); } |
166 |
> |
public FJException(Throwable cause) { super(cause); } |
167 |
|
} |
168 |
|
|
169 |
|
// A simple recursive action for testing |
772 |
|
ForkJoinWorkerThread w = |
773 |
|
(ForkJoinWorkerThread) Thread.currentThread(); |
774 |
|
assertTrue(w.getPoolIndex() >= 0); |
775 |
< |
assertTrue(w.getPoolIndex() < mainPool.getPoolSize()); |
775 |
> |
// pool size can shrink after assigning index, so cannot check |
776 |
> |
// assertTrue(w.getPoolIndex() < mainPool.getPoolSize()); |
777 |
|
}}; |
778 |
|
testInvokeOnPool(mainPool, a); |
779 |
|
} |