jdk/src/share/classes/java/util/concurrent/ExecutorService.java
changeset 19048 7d0a94c79779
parent 18790 d25399d849bc
equal deleted inserted replaced
19047:08210fe86260 19048:7d0a94c79779
   225      * that can convert some other common closure-like objects,
   225      * that can convert some other common closure-like objects,
   226      * for example, {@link java.security.PrivilegedAction} to
   226      * for example, {@link java.security.PrivilegedAction} to
   227      * {@link Callable} form so they can be submitted.
   227      * {@link Callable} form so they can be submitted.
   228      *
   228      *
   229      * @param task the task to submit
   229      * @param task the task to submit
       
   230      * @param <T> the type of the task's result
   230      * @return a Future representing pending completion of the task
   231      * @return a Future representing pending completion of the task
   231      * @throws RejectedExecutionException if the task cannot be
   232      * @throws RejectedExecutionException if the task cannot be
   232      *         scheduled for execution
   233      *         scheduled for execution
   233      * @throws NullPointerException if the task is null
   234      * @throws NullPointerException if the task is null
   234      */
   235      */
   239      * representing that task. The Future's {@code get} method will
   240      * representing that task. The Future's {@code get} method will
   240      * return the given result upon successful completion.
   241      * return the given result upon successful completion.
   241      *
   242      *
   242      * @param task the task to submit
   243      * @param task the task to submit
   243      * @param result the result to return
   244      * @param result the result to return
       
   245      * @param <T> the type of the result
   244      * @return a Future representing pending completion of the task
   246      * @return a Future representing pending completion of the task
   245      * @throws RejectedExecutionException if the task cannot be
   247      * @throws RejectedExecutionException if the task cannot be
   246      *         scheduled for execution
   248      *         scheduled for execution
   247      * @throws NullPointerException if the task is null
   249      * @throws NullPointerException if the task is null
   248      */
   250      */
   270      * terminated either normally or by throwing an exception.
   272      * terminated either normally or by throwing an exception.
   271      * The results of this method are undefined if the given
   273      * The results of this method are undefined if the given
   272      * collection is modified while this operation is in progress.
   274      * collection is modified while this operation is in progress.
   273      *
   275      *
   274      * @param tasks the collection of tasks
   276      * @param tasks the collection of tasks
       
   277      * @param <T> the type of the values returned from the tasks
   275      * @return a list of Futures representing the tasks, in the same
   278      * @return a list of Futures representing the tasks, in the same
   276      *         sequential order as produced by the iterator for the
   279      *         sequential order as produced by the iterator for the
   277      *         given task list, each of which has completed
   280      *         given task list, each of which has completed
   278      * @throws InterruptedException if interrupted while waiting, in
   281      * @throws InterruptedException if interrupted while waiting, in
   279      *         which case unfinished tasks are cancelled
   282      *         which case unfinished tasks are cancelled
   297      * collection is modified while this operation is in progress.
   300      * collection is modified while this operation is in progress.
   298      *
   301      *
   299      * @param tasks the collection of tasks
   302      * @param tasks the collection of tasks
   300      * @param timeout the maximum time to wait
   303      * @param timeout the maximum time to wait
   301      * @param unit the time unit of the timeout argument
   304      * @param unit the time unit of the timeout argument
       
   305      * @param <T> the type of the values returned from the tasks
   302      * @return a list of Futures representing the tasks, in the same
   306      * @return a list of Futures representing the tasks, in the same
   303      *         sequential order as produced by the iterator for the
   307      *         sequential order as produced by the iterator for the
   304      *         given task list. If the operation did not time out,
   308      *         given task list. If the operation did not time out,
   305      *         each task will have completed. If it did time out, some
   309      *         each task will have completed. If it did time out, some
   306      *         of these tasks will not have completed.
   310      *         of these tasks will not have completed.
   322      * tasks that have not completed are cancelled.
   326      * tasks that have not completed are cancelled.
   323      * The results of this method are undefined if the given
   327      * The results of this method are undefined if the given
   324      * collection is modified while this operation is in progress.
   328      * collection is modified while this operation is in progress.
   325      *
   329      *
   326      * @param tasks the collection of tasks
   330      * @param tasks the collection of tasks
       
   331      * @param <T> the type of the values returned from the tasks
   327      * @return the result returned by one of the tasks
   332      * @return the result returned by one of the tasks
   328      * @throws InterruptedException if interrupted while waiting
   333      * @throws InterruptedException if interrupted while waiting
   329      * @throws NullPointerException if tasks or any element task
   334      * @throws NullPointerException if tasks or any element task
   330      *         subject to execution is {@code null}
   335      *         subject to execution is {@code null}
   331      * @throws IllegalArgumentException if tasks is empty
   336      * @throws IllegalArgumentException if tasks is empty
   346      * collection is modified while this operation is in progress.
   351      * collection is modified while this operation is in progress.
   347      *
   352      *
   348      * @param tasks the collection of tasks
   353      * @param tasks the collection of tasks
   349      * @param timeout the maximum time to wait
   354      * @param timeout the maximum time to wait
   350      * @param unit the time unit of the timeout argument
   355      * @param unit the time unit of the timeout argument
       
   356      * @param <T> the type of the values returned from the tasks
   351      * @return the result returned by one of the tasks
   357      * @return the result returned by one of the tasks
   352      * @throws InterruptedException if interrupted while waiting
   358      * @throws InterruptedException if interrupted while waiting
   353      * @throws NullPointerException if tasks, or unit, or any element
   359      * @throws NullPointerException if tasks, or unit, or any element
   354      *         task subject to execution is {@code null}
   360      *         task subject to execution is {@code null}
   355      * @throws TimeoutException if the given timeout elapses before
   361      * @throws TimeoutException if the given timeout elapses before