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

Comparing jsr166/src/main/java/util/concurrent/ForkJoinPool.java (file contents):
Revision 1.10 by jsr166, Tue Aug 4 20:41:40 2009 UTC vs.
Revision 1.11 by jsr166, Wed Aug 12 04:10:59 2009 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines