ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166y/ForkJoinTask.java
(Generate patch)

Comparing jsr166/src/jsr166y/ForkJoinTask.java (file contents):
Revision 1.75 by dl, Tue Feb 22 10:50:51 2011 UTC vs.
Revision 1.76 by dl, Fri Mar 4 13:29:39 2011 UTC

# Line 384 | Line 384 | public abstract class ForkJoinTask<V> im
384       * periods. However, since we do not know when the last joiner
385       * completes, we must use weak references and expunge them. We do
386       * so on each operation (hence full locking). Also, some thread in
387 <     * any ForkJoinPool will call helpExpunge when its pool becomes
388 <     * isQuiescent.
387 >     * any ForkJoinPool will call helpExpungeStaleExceptions when its
388 >     * pool becomes isQuiescent.
389       */
390      static final class ExceptionNode extends WeakReference<ForkJoinTask<?>>{
391          final Throwable ex;
392          ExceptionNode next;
393 <        final long thrower;
393 >        final long thrower;  // use id not ref to avoid weak cycles
394          ExceptionNode(ForkJoinTask<?> task, Throwable ex, ExceptionNode next) {
395              super(task, exceptionTableRefQueue);
396              this.ex = ex;
# Line 406 | Line 406 | public abstract class ForkJoinTask<V> im
406       */
407      private int setExceptionalCompletion(Throwable ex) {
408          int h = System.identityHashCode(this);
409 <        ReentrantLock lock = exceptionTableLock;
409 >        final ReentrantLock lock = exceptionTableLock;
410          lock.lock();
411          try {
412              expungeStaleExceptions();
# Line 431 | Line 431 | public abstract class ForkJoinTask<V> im
431       */
432      private void clearExceptionalCompletion() {
433          int h = System.identityHashCode(this);
434 <        ReentrantLock lock = exceptionTableLock;
434 >        final ReentrantLock lock = exceptionTableLock;
435          lock.lock();
436          try {
437              ExceptionNode[] t = exceptionTable;
# Line 476 | Line 476 | public abstract class ForkJoinTask<V> im
476              return null;
477          int h = System.identityHashCode(this);
478          ExceptionNode e;
479 <        ReentrantLock lock = exceptionTableLock;
479 >        final ReentrantLock lock = exceptionTableLock;
480          lock.lock();
481          try {
482              expungeStaleExceptions();
# Line 542 | Line 542 | public abstract class ForkJoinTask<V> im
542      }
543  
544      /**
545 <     * If lock is available, poll any stale refs and remove them.
545 >     * If lock is available, poll stale refs and remove them.
546       * Called from ForkJoinPool when pools become quiescent.
547       */
548      static final void helpExpungeStaleExceptions() {
549 <        ReentrantLock lock = exceptionTableLock;
549 >        final ReentrantLock lock = exceptionTableLock;
550          if (lock.tryLock()) {
551              try {
552                  expungeStaleExceptions();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines