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

Comparing jsr166/src/main/java/util/concurrent/FutureTask.java (file contents):
Revision 1.84 by jsr166, Sat Jun 18 22:24:25 2011 UTC vs.
Revision 1.85 by jsr166, Sun Jun 19 03:21:58 2011 UTC

# Line 103 | Line 103 | public class FutureTask<V> implements Ru
103          if (callable == null)
104              throw new NullPointerException();
105          this.callable = callable;
106 <        this.state = NEW;
106 >        this.state = NEW;       // ensure visibility of callable
107      }
108  
109      /**
# Line 120 | Line 120 | public class FutureTask<V> implements Ru
120       */
121      public FutureTask(Runnable runnable, V result) {
122          this.callable = Executors.callable(runnable, result);
123 <        this.state = NEW;
123 >        this.state = NEW;       // ensure visibility of callable
124      }
125  
126      public boolean isCancelled() {
# Line 232 | Line 232 | public class FutureTask<V> implements Ru
232                  }
233                  if (ran)
234                      set(result);
235                callable = null;      // null out upon use to reduce footprint
235              }
236              runner = null;
237              if (state >= INTERRUPTING) {
# Line 276 | Line 275 | public class FutureTask<V> implements Ru
275                      Thread.interrupted(); // clear interrupt from cancel(true)
276                  }
277              }
279            if (!rerun)
280                callable = null;
278          }
279          return rerun;
280      }
# Line 294 | Line 291 | public class FutureTask<V> implements Ru
291      }
292  
293      /**
294 <     * Removes and signals all waiting threads, and invokes done().
294 >     * Removes and signals all waiting threads, invokes done(), and
295 >     * nulls out callable.
296       */
297      private void finishCompletion() {
298          for (WaitNode q; (q = waiters) != null;) {
# Line 314 | Line 312 | public class FutureTask<V> implements Ru
312                  break;
313              }
314          }
315 +
316          done();
317 +
318 +        callable = null;        // to reduce footprint
319      }
320  
321      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines