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

Comparing jsr166/src/main/java/util/concurrent/CompletableFuture.java (file contents):
Revision 1.190 by jsr166, Sun May 1 04:26:48 2016 UTC vs.
Revision 1.191 by jsr166, Sun May 1 22:08:44 2016 UTC

# Line 327 | Line 327 | public class CompletableFuture<T> implem
327       */
328      static Object encodeRelay(Object r) {
329          Throwable x;
330 <        return (((r instanceof AltResult) &&
331 <                 (x = ((AltResult)r).ex) != null &&
332 <                 !(x instanceof CompletionException)) ?
333 <                new AltResult(new CompletionException(x)) : r);
330 >        if (r instanceof AltResult
331 >            && (x = ((AltResult)r).ex) != null
332 >            && !(x instanceof CompletionException))
333 >            r = new AltResult(new CompletionException(x));
334 >        return r;
335      }
336  
337      /**
# Line 2015 | Line 2016 | public class CompletableFuture<T> implem
2016      @SuppressWarnings("unchecked")
2017      public T get() throws InterruptedException, ExecutionException {
2018          Object r;
2019 <        return (T) reportGet((r = result) == null ? waitingGet(true) : r);
2019 >        if ((r = result) == null)
2020 >            r = waitingGet(true);
2021 >        return (T) reportGet(r);
2022      }
2023  
2024      /**
# Line 2034 | Line 2037 | public class CompletableFuture<T> implem
2037      @SuppressWarnings("unchecked")
2038      public T get(long timeout, TimeUnit unit)
2039          throws InterruptedException, ExecutionException, TimeoutException {
2037        Object r;
2040          long nanos = unit.toNanos(timeout);
2041 <        return (T) reportGet((r = result) == null ? timedGet(nanos) : r);
2041 >        Object r;
2042 >        if ((r = result) == null)
2043 >            r = timedGet(nanos);
2044 >        return (T) reportGet(r);
2045      }
2046  
2047      /**
# Line 2056 | Line 2061 | public class CompletableFuture<T> implem
2061      @SuppressWarnings("unchecked")
2062      public T join() {
2063          Object r;
2064 <        return (T) reportJoin((r = result) == null ? waitingGet(false) : r);
2064 >        if ((r = result) == null)
2065 >            r = waitingGet(false);
2066 >        return (T) reportJoin(r);
2067      }
2068  
2069      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines