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

Comparing jsr166/src/main/java/util/concurrent/CancellableTask.java (file contents):
Revision 1.4 by brian, Mon Jun 23 02:26:16 2003 UTC vs.
Revision 1.5 by dl, Tue Jun 24 14:34:47 2003 UTC

# Line 12 | Line 12 | import java.util.concurrent.atomic.*;
12   * framework. In addition to serving as a standalone class, this
13   * provides <tt>protected</tt> functionality that may be useful when
14   * creating customized task classes.
15 + * @since 1.5
16 + * @author Doug Lea
17   */
18  
19   public class CancellableTask implements Cancellable, Runnable {
# Line 25 | Line 27 | public class CancellableTask implements
27       */
28      private volatile Object runner;
29  
30 <    /*
30 >    /**
31       * Special value for "runner" indicating task is completed
32       */
33      private static final Object DONE = new Object();
34  
35 <    /*
35 >    /**
36       * Special value for "runner" indicating task is cancelled
37       */
38      private static final Object CANCELLED = new Object();
# Line 46 | Line 48 | public class CancellableTask implements
48      /**
49       * Creates a new CancellableTask which invokes the given
50       * <tt>Runnable</tt> when executed.
51 +     * @param r the runnable action
52       */
53      public CancellableTask(Runnable r) {
54          this.runnable = r;
# Line 89 | Line 92 | public class CancellableTask implements
92  
93      /**
94       * Return the Runnable forming the basis of this task.
95 +     * @return the runnable action
96       */
97      protected Runnable getRunnable() {
98          return runnable;
# Line 96 | Line 100 | public class CancellableTask implements
100  
101      /**
102       * Set the Runnable forming the basis of this task.
103 +     * @param r the runnable action
104       */
105      protected void setRunnable(Runnable r) {
106          runnable = r;
# Line 154 | Line 159 | public class CancellableTask implements
159          private final Condition accessible = lock.newCondition();
160          private V result;
161          private Throwable exception;
162 +
163 +        /**
164 +         * Create an InnerCancellableFuture that will execute the
165 +         * given callable.
166 +         * @param callable the function to execute
167 +         */
168          protected InnerCancellableFuture(Callable<V> callable) {
169              this.callable = callable;
170          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines