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.139 by dl, Tue Jan 6 16:14:25 2015 UTC vs.
Revision 1.140 by dl, Tue Jan 6 18:03:27 2015 UTC

# Line 939 | Line 939 | public class CompletableFuture<T> implem
939              }
940              try {
941                  @SuppressWarnings("unchecked") T t = (T) r;
942 <                return new CompletableFuture<V>(
943 <                    encodeRelay(f.apply(t).toCompletableFuture().result));
942 >                CompletableFuture<V> g = f.apply(t).toCompletableFuture();
943 >                Object s = g.result;
944 >                if (s != null)
945 >                    return new CompletableFuture<V>(encodeRelay(s));
946 >                CompletableFuture<V> d = new CompletableFuture<V>();
947 >                UniRelay<V> copy = new UniRelay<V>(d, g);
948 >                g.push(copy);
949 >                copy.tryFire(SYNC);
950 >                return d;
951              } catch (Throwable ex) {
952                  return new CompletableFuture<V>(encodeThrowable(ex));
953              }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines