395 |
|
final Throwable ex; |
396 |
|
ExceptionNode next; |
397 |
|
final long thrower; // use id not ref to avoid weak cycles |
398 |
+ |
final int hashCode; // store task hashCode before weak ref disappears |
399 |
|
ExceptionNode(ForkJoinTask<?> task, Throwable ex, ExceptionNode next) { |
400 |
|
super(task, exceptionTableRefQueue); |
401 |
|
this.ex = ex; |
402 |
|
this.next = next; |
403 |
|
this.thrower = Thread.currentThread().getId(); |
404 |
+ |
this.hashCode = System.identityHashCode(task); |
405 |
|
} |
406 |
|
} |
407 |
|
|
470 |
|
} |
471 |
|
|
472 |
|
/** |
473 |
< |
* Removes exception node and clears status |
473 |
> |
* Removes exception node and clears status. |
474 |
|
*/ |
475 |
|
private void clearExceptionalCompletion() { |
476 |
|
int h = System.identityHashCode(this); |
563 |
|
private static void expungeStaleExceptions() { |
564 |
|
for (Object x; (x = exceptionTableRefQueue.poll()) != null;) { |
565 |
|
if (x instanceof ExceptionNode) { |
566 |
< |
ForkJoinTask<?> key = ((ExceptionNode)x).get(); |
566 |
> |
int hashCode = ((ExceptionNode)x).hashCode; |
567 |
|
ExceptionNode[] t = exceptionTable; |
568 |
< |
int i = System.identityHashCode(key) & (t.length - 1); |
568 |
> |
int i = hashCode & (t.length - 1); |
569 |
|
ExceptionNode e = t[i]; |
570 |
|
ExceptionNode pred = null; |
571 |
|
while (e != null) { |
1067 |
|
|
1068 |
|
/** |
1069 |
|
* Possibly executes tasks until the pool hosting the current task |
1070 |
< |
* {@link ForkJoinPool#isQuiescent is quiescent}. This method may |
1071 |
< |
* be of use in designs in which many tasks are forked, but none |
1072 |
< |
* are explicitly joined, instead executing them until all are |
1073 |
< |
* processed. |
1070 |
> |
* {@linkplain ForkJoinPool#isQuiescent is quiescent}. This |
1071 |
> |
* method may be of use in designs in which many tasks are forked, |
1072 |
> |
* but none are explicitly joined, instead executing them until |
1073 |
> |
* all are processed. |
1074 |
|
*/ |
1075 |
|
public static void helpQuiesce() { |
1076 |
|
Thread t; |
1328 |
|
} |
1329 |
|
|
1330 |
|
/** |
1331 |
< |
* Adaptor for Runnables. This implements RunnableFuture |
1331 |
> |
* Adapter for Runnables. This implements RunnableFuture |
1332 |
|
* to be compliant with AbstractExecutorService constraints |
1333 |
|
* when used in ForkJoinPool. |
1334 |
|
*/ |
1349 |
|
} |
1350 |
|
|
1351 |
|
/** |
1352 |
< |
* Adaptor for Runnables without results |
1352 |
> |
* Adapter for Runnables without results |
1353 |
|
*/ |
1354 |
|
static final class AdaptedRunnableAction extends ForkJoinTask<Void> |
1355 |
|
implements RunnableFuture<Void> { |
1366 |
|
} |
1367 |
|
|
1368 |
|
/** |
1369 |
< |
* Adaptor for Callables |
1369 |
> |
* Adapter for Callables |
1370 |
|
*/ |
1371 |
|
static final class AdaptedCallable<T> extends ForkJoinTask<T> |
1372 |
|
implements RunnableFuture<T> { |