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 |
|
} |