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

Comparing jsr166/src/jsr166y/ForkJoinPool.java (file contents):
Revision 1.47 by jsr166, Wed Aug 5 15:40:09 2009 UTC vs.
Revision 1.48 by jsr166, Thu Aug 6 06:41:34 2009 UTC

# Line 23 | Line 23 | import java.util.concurrent.atomic.Atomi
23   * An {@link ExecutorService} for running {@link ForkJoinTask}s.
24   * A {@code ForkJoinPool} provides the entry point for submissions
25   * from non-{@code ForkJoinTask}s, as well as management and
26 < * monitoring operations.  
26 > * monitoring operations.
27   *
28   * <p>A {@code ForkJoinPool} differs from other kinds of {@link
29   * ExecutorService} mainly by virtue of employing
# Line 82 | Line 82 | import java.util.concurrent.atomic.Atomi
82   *
83   * <p><b>Implementation notes</b>: This implementation restricts the
84   * maximum number of running threads to 32767. Attempts to create
85 < * pools with greater than the maximum result in
85 > * pools with greater than the maximum number result in
86   * {@code IllegalArgumentException}.
87   *
88 + * <p>This implementation rejects submitted tasks (that is, by throwing
89 + * {@link RejectedExecutionException}) only when the pool is shut down.
90 + *
91   * @since 1.7
92   * @author Doug Lea
93   */
# Line 112 | Line 115 | public class ForkJoinPool extends Abstra
115           * Returns a new worker thread operating in the given pool.
116           *
117           * @param pool the pool this thread works in
118 <         * @throws NullPointerException if pool is null
118 >         * @throws NullPointerException if the pool is null
119           */
120          public ForkJoinWorkerThread newThread(ForkJoinPool pool);
121      }
# Line 400 | Line 403 | public class ForkJoinPool extends Abstra
403       * thread factory.
404       *
405       * @param factory the factory for creating new threads
406 <     * @throws NullPointerException if factory is null
406 >     * @throws NullPointerException if the factory is null
407       * @throws SecurityException if a security manager exists and
408       *         the caller is not permitted to modify threads
409       *         because it does not hold {@link
# Line 418 | Line 421 | public class ForkJoinPool extends Abstra
421       * @param factory the factory for creating new threads
422       * @throws IllegalArgumentException if parallelism less than or
423       *         equal to zero, or greater than implementation limit
424 <     * @throws NullPointerException if factory is null
424 >     * @throws NullPointerException if the factory is null
425       * @throws SecurityException if a security manager exists and
426       *         the caller is not permitted to modify threads
427       *         because it does not hold {@link
# Line 594 | Line 597 | public class ForkJoinPool extends Abstra
597       *
598       * @param task the task
599       * @return the task's result
600 <     * @throws NullPointerException if task is null
601 <     * @throws RejectedExecutionException if pool is shut down
600 >     * @throws NullPointerException if the task is null
601 >     * @throws RejectedExecutionException if the task cannot be
602 >     *         scheduled for execution
603       */
604      public <T> T invoke(ForkJoinTask<T> task) {
605          doSubmit(task);
# Line 606 | Line 610 | public class ForkJoinPool extends Abstra
610       * Arranges for (asynchronous) execution of the given task.
611       *
612       * @param task the task
613 <     * @throws NullPointerException if task is null
614 <     * @throws RejectedExecutionException if pool is shut down
613 >     * @throws NullPointerException if the task is null
614 >     * @throws RejectedExecutionException if the task cannot be
615 >     *         scheduled for execution
616       */
617      public void execute(ForkJoinTask<?> task) {
618          doSubmit(task);
# Line 615 | Line 620 | public class ForkJoinPool extends Abstra
620  
621      // AbstractExecutorService methods
622  
623 +    /**
624 +     * @throws NullPointerException if the task is null
625 +     * @throws RejectedExecutionException if the task cannot be
626 +     *         scheduled for execution
627 +     */
628      public void execute(Runnable task) {
629          ForkJoinTask<?> job;
630          if (task instanceof ForkJoinTask<?>) // avoid re-wrap
# Line 624 | Line 634 | public class ForkJoinPool extends Abstra
634          doSubmit(job);
635      }
636  
637 +    /**
638 +     * @throws NullPointerException if the task is null
639 +     * @throws RejectedExecutionException if the task cannot be
640 +     *         scheduled for execution
641 +     */
642      public <T> ForkJoinTask<T> submit(Callable<T> task) {
643          ForkJoinTask<T> job = ForkJoinTask.adapt(task);
644          doSubmit(job);
645          return job;
646      }
647  
648 +    /**
649 +     * @throws NullPointerException if the task is null
650 +     * @throws RejectedExecutionException if the task cannot be
651 +     *         scheduled for execution
652 +     */
653      public <T> ForkJoinTask<T> submit(Runnable task, T result) {
654          ForkJoinTask<T> job = ForkJoinTask.adapt(task, result);
655          doSubmit(job);
656          return job;
657      }
658  
659 +    /**
660 +     * @throws NullPointerException if the task is null
661 +     * @throws RejectedExecutionException if the task cannot be
662 +     *         scheduled for execution
663 +     */
664      public ForkJoinTask<?> submit(Runnable task) {
665          ForkJoinTask<?> job;
666          if (task instanceof ForkJoinTask<?>) // avoid re-wrap
# Line 651 | Line 676 | public class ForkJoinPool extends Abstra
676       *
677       * @param task the task to submit
678       * @return the task
679 +     * @throws NullPointerException if the task is null
680       * @throws RejectedExecutionException if the task cannot be
681       *         scheduled for execution
656     * @throws NullPointerException if the task is null
682       */
683      public <T> ForkJoinTask<T> submit(ForkJoinTask<T> task) {
684          doSubmit(task);
# Line 661 | Line 686 | public class ForkJoinPool extends Abstra
686      }
687  
688  
689 +    /**
690 +     * @throws NullPointerException       {@inheritDoc}
691 +     * @throws RejectedExecutionException {@inheritDoc}
692 +     */
693      public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) {
694          ArrayList<ForkJoinTask<T>> forkJoinTasks =
695              new ArrayList<ForkJoinTask<T>>(tasks.size());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines