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.94 by dl, Mon Nov 19 18:12:42 2012 UTC vs.
Revision 1.98 by dl, Tue Jan 1 15:10:39 2013 UTC

# Line 55 | Line 55 | import java.lang.reflect.Constructor;
55   * minimize other blocking synchronization apart from joining other
56   * tasks or using synchronizers such as Phasers that are advertised to
57   * cooperate with fork/join scheduling. Subdividable tasks should also
58 < * not perform blocking IO, and should ideally access variables that
58 > * not perform blocking I/O, and should ideally access variables that
59   * are completely independent of those accessed by other running
60   * tasks. These guidelines are loosely enforced by not permitting
61   * checked exceptions such as {@code IOExceptions} to be
# Line 73 | Line 73 | import java.lang.reflect.Constructor;
73   * <p>It is possible to define and use ForkJoinTasks that may block,
74   * but doing do requires three further considerations: (1) Completion
75   * of few if any <em>other</em> tasks should be dependent on a task
76 < * that blocks on external synchronization or IO. Event-style async
76 > * that blocks on external synchronization or I/O. Event-style async
77   * tasks that are never joined (for example, those subclassing {@link
78   * CountedCompleter}) often fall into this category.  (2) To minimize
79   * resource impact, tasks should be small; ideally performing only the
# Line 435 | Line 435 | public abstract class ForkJoinTask<V> im
435      }
436  
437      /**
438 <     * Records exception and possibly propagates
438 >     * Records exception and possibly propagates.
439       *
440       * @return status on exit
441       */
# Line 606 | Line 606 | public abstract class ForkJoinTask<V> im
606                  throw (Error)ex;
607              if (ex instanceof RuntimeException)
608                  throw (RuntimeException)ex;
609 <            throw uncheckedThrowable(ex, RuntimeException.class);
609 >            ForkJoinTask.<RuntimeException>uncheckedThrow(ex);
610          }
611      }
612  
# Line 616 | Line 616 | public abstract class ForkJoinTask<V> im
616       * unchecked exceptions
617       */
618      @SuppressWarnings("unchecked") static <T extends Throwable>
619 <        T uncheckedThrowable(final Throwable t, final Class<T> c) {
620 <        return (T)t; // rely on vacuous cast
619 >        void uncheckedThrow(Throwable t) throws T {
620 >        if (t != null)
621 >            throw (T)t; // rely on vacuous cast
622      }
623  
624      /**
# Line 652 | Line 653 | public abstract class ForkJoinTask<V> im
653          if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
654              ((ForkJoinWorkerThread)t).workQueue.push(this);
655          else
656 <            ForkJoinPool.commonPool.externalPush(this);
656 >            ForkJoinPool.common.externalPush(this);
657          return this;
658      }
659  
# Line 978 | Line 979 | public abstract class ForkJoinTask<V> im
979          if (Thread.interrupted())
980              throw new InterruptedException();
981          // Messy in part because we measure in nanosecs, but wait in millisecs
982 <        int s; long ns, ms;
983 <        if ((s = status) >= 0 && (ns = unit.toNanos(timeout)) > 0L) {
982 >        int s; long ms;
983 >        long ns = unit.toNanos(timeout);
984 >        if ((s = status) >= 0 && ns > 0L) {
985              long deadline = System.nanoTime() + ns;
986              ForkJoinPool p = null;
987              ForkJoinPool.WorkQueue w = null;
# Line 1075 | Line 1077 | public abstract class ForkJoinTask<V> im
1077              wt.pool.helpQuiescePool(wt.workQueue);
1078          }
1079          else
1080 <            ForkJoinPool.externalHelpQuiescePool();
1080 >            ForkJoinPool.quiesceCommonPool();
1081      }
1082  
1083      /**
# Line 1500 | Line 1502 | public abstract class ForkJoinTask<V> im
1502              }
1503          }
1504      }
1505 +
1506   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines