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.99 by jsr166, Tue Dec 20 01:03:46 2011 UTC vs.
Revision 1.100 by dl, Fri Dec 14 12:29:51 2012 UTC

# Line 138 | Line 138 | public class FutureTask<V> implements Ru
138          if (mayInterruptIfRunning) {
139              if (!UNSAFE.compareAndSwapInt(this, stateOffset, NEW, INTERRUPTING))
140                  return false;
141 <            Thread t = runner;
142 <            if (t != null)
143 <                t.interrupt();
144 <            UNSAFE.putOrderedInt(this, stateOffset, INTERRUPTED); // final state
141 >            try {       // in case call to interrupt throws exception
142 >                Thread t = runner;
143 >                if (t != null)
144 >                    t.interrupt();
145 >            } finally { // final state
146 >                UNSAFE.putOrderedInt(this, stateOffset, INTERRUPTED);
147 >            }
148          }
149          else if (!UNSAFE.compareAndSwapInt(this, stateOffset, NEW, CANCELLED))
150              return false;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines