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

Comparing jsr166/src/main/java/util/concurrent/Future.java (file contents):
Revision 1.41 by jsr166, Sat Oct 8 18:52:37 2016 UTC vs.
Revision 1.42 by dl, Fri Sep 18 14:33:57 2020 UTC

# Line 59 | Line 59 | package java.util.concurrent;
59   public interface Future<V> {
60  
61      /**
62 <     * Attempts to cancel execution of this task.  This attempt will
63 <     * fail if the task has already completed, has already been cancelled,
64 <     * or could not be cancelled for some other reason. If successful,
65 <     * and this task has not started when {@code cancel} is called,
66 <     * this task should never run.  If the task has already started,
67 <     * then the {@code mayInterruptIfRunning} parameter determines
68 <     * whether the thread executing this task should be interrupted in
69 <     * an attempt to stop the task.
62 >     * Attempts to cancel execution of this task.  This method has no
63 >     * effect if the task is already completed or cancelled, or could
64 >     * not be cancelled for some other reason.  Otherwise, if this
65 >     * task has not started when {@code cancel} is called, this task
66 >     * should never run.  If the task has already started, then the
67 >     * {@code mayInterruptIfRunning} parameter determines whether the
68 >     * thread executing this task (when known by the implementation)
69 >     * is interrupted in an attempt to stop the task.
70       *
71 <     * <p>After this method returns, subsequent calls to {@link #isDone} will
72 <     * always return {@code true}.  Subsequent calls to {@link #isCancelled}
73 <     * will always return {@code true} if this method returned {@code true}.
71 >     * <p>The return value from this method does not necessarily
72 >     * indicate whether the task is now cancelled; use {@link
73 >     * #isCancelled}.
74       *
75 <     * @param mayInterruptIfRunning {@code true} if the thread executing this
76 <     * task should be interrupted; otherwise, in-progress tasks are allowed
77 <     * to complete
75 >     * @param mayInterruptIfRunning {@code true} if the thread
76 >     * executing this task should be interrupted (if the thread is
77 >     * known to the implementation); otherwise, in-progress tasks are
78 >     * allowed to complete
79       * @return {@code false} if the task could not be cancelled,
80 <     * typically because it has already completed normally;
81 <     * {@code true} otherwise
80 >     * typically because it has already completed; {@code true}
81 >     * otherwise. If two or more threads cause a task to be cancelled,
82 >     * then at least one of them returns {@code true}. Implementations
83 >     * may provide stronger guarantees.
84       */
85      boolean cancel(boolean mayInterruptIfRunning);
86  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines