jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java
changeset 28540 04b399ec3dfc
parent 26336 1eee453c24c1
child 32987 e5e5ab01398e
equal deleted inserted replaced
28539:bb420dbad9d2 28540:04b399ec3dfc
   976                 }
   976                 }
   977                 r = null;
   977                 r = null;
   978             }
   978             }
   979             try {
   979             try {
   980                 @SuppressWarnings("unchecked") T t = (T) r;
   980                 @SuppressWarnings("unchecked") T t = (T) r;
   981                 return f.apply(t).toCompletableFuture();
   981                 CompletableFuture<V> g = f.apply(t).toCompletableFuture();
       
   982                 Object s = g.result;
       
   983                 if (s != null)
       
   984                     return new CompletableFuture<V>(encodeRelay(s));
       
   985                 CompletableFuture<V> d = new CompletableFuture<V>();
       
   986                 UniRelay<V> copy = new UniRelay<V>(d, g);
       
   987                 g.push(copy);
       
   988                 copy.tryFire(SYNC);
       
   989                 return d;
   982             } catch (Throwable ex) {
   990             } catch (Throwable ex) {
   983                 return new CompletableFuture<V>(encodeThrowable(ex));
   991                 return new CompletableFuture<V>(encodeThrowable(ex));
   984             }
   992             }
   985         }
   993         }
   986         CompletableFuture<V> d = new CompletableFuture<V>();
   994         CompletableFuture<V> d = new CompletableFuture<V>();