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.16 by dl, Mon Nov 10 17:31:23 2003 UTC vs.
Revision 1.17 by dl, Thu Dec 4 20:54:29 2003 UTC

# Line 12 | Line 12 | package java.util.concurrent;
12   * complete, to wait for its completion, and to retrieve the result of
13   * the computation.  The result can only be retrieved using method
14   * <tt>get</tt> when the computation has completed, blocking if
15 < * necessary until it is ready.  Once the computation has completed,
16 < * the computation cannot be cancelled.
15 > * necessary until it is ready.  Cancellation is performed by the
16 > * <tt>cancel</tt> method.  Additional methods are provided to
17 > * determine if the task completed normally or was cancelled. Once a
18 > * computation has completed, the computation cannot be cancelled.
19   *
20   * <p>
21   * <b>Sample Usage</b> (Note that the following classes are all
# Line 54 | Line 56 | package java.util.concurrent;
56   * @author Doug Lea
57   * @param <V> The result type returned by this Future's <tt>get</tt> method
58   */
59 < public interface Future<V> extends Cancellable {
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, already been cancelled,
64 >     * or could not be cancelled for some other reason. If successful,
65 >     * and this task has not started when <tt>cancel</tt> is called,
66 >     * this task should never run.  If the task has already started,
67 >     * then the <tt>interruptIfRunning</tt> parameter determines
68 >     * whether the thread executing this task should be interrupted in
69 >     * an attempt to stop the task.
70 >     *
71 >     * @param mayInterruptIfRunning <tt>true</tt> if the thread executing this
72 >     * task should be interrupted; otherwise, in-progress tasks are allowed
73 >     * to complete
74 >     * @return <tt>false</tt> if the task could not be cancelled,
75 >     * typically because is has already completed normally;
76 >     * <tt>true</tt> otherwise
77 >     */
78 >    boolean cancel(boolean mayInterruptIfRunning);
79 >
80 >    /**
81 >     * Returns <tt>true</tt> if this task was cancelled before it completed
82 >     * normally.
83 >     *
84 >     * @return <tt>true</tt> if task was cancelled before it completed
85 >     */
86 >    boolean isCancelled();
87 >
88 >    /**
89 >     * Returns <tt>true</tt> if this task completed.  
90 >     *
91 >     * Completion may be due to normal termination, an exception, or
92 >     * cancellation -- in all of these cases, this method will return
93 >     * <tt>true</tt>.
94 >     *
95 >     * @return <tt>true</tt> if this task completed.
96 >     */
97 >    boolean isDone();
98  
99      /**
100       * Waits if necessary for computation to complete, and then

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines