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

Comparing jsr166/src/main/java/util/concurrent/Exchanger.java (file contents):
Revision 1.51 by jsr166, Fri Dec 2 13:00:25 2011 UTC vs.
Revision 1.52 by jsr166, Fri Dec 2 15:47:22 2011 UTC

# Line 590 | Line 590 | public class Exchanger<V> {
590       * @throws InterruptedException if the current thread was
591       *         interrupted while waiting
592       */
593 +    @SuppressWarnings("unchecked")
594      public V exchange(V x) throws InterruptedException {
595          if (!Thread.interrupted()) {
596              Object o = doExchange((x == null) ? NULL_ITEM : x, false, 0);
597              if (o == NULL_ITEM)
598                  return null;
599 <            if (o != CANCEL) {
600 <                @SuppressWarnings("unchecked") V v = (V)o;
600 <                return v;
601 <            }
599 >            if (o != CANCEL)
600 >                return (V)o;
601              Thread.interrupted(); // Clear interrupt status on IE throw
602          }
603          throw new InterruptedException();
# Line 646 | Line 645 | public class Exchanger<V> {
645       * @throws TimeoutException if the specified waiting time elapses
646       *         before another thread enters the exchange
647       */
648 +    @SuppressWarnings("unchecked")
649      public V exchange(V x, long timeout, TimeUnit unit)
650          throws InterruptedException, TimeoutException {
651          if (!Thread.interrupted()) {
# Line 653 | Line 653 | public class Exchanger<V> {
653                                    true, unit.toNanos(timeout));
654              if (o == NULL_ITEM)
655                  return null;
656 <            if (o != CANCEL) {
657 <                @SuppressWarnings("unchecked") V v = (V)o;
658 <                return v;
659 <            }
656 >            if (o != CANCEL)
657 >                return (V)o;
658              if (!Thread.interrupted())
659                  throw new TimeoutException();
660          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines