MCPcopy Create free account
hub / github.com/traneio/future / Continuation

Class Continuation

future-java/src/main/java/io/trane/future/Promise.java:866–898  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

864}
865
866abstract class Continuation<T, R> extends Promise<R> implements WaitQueue<T> {
867
868 @Override
869 public final WaitQueue<T> add(final Continuation<T, ?> c) {
870 return new WaitQueueHeadTail<>(c, this);
871 }
872
873 @Override
874 public final void forward(final Promise<T> target) {
875 target.continuation(this);
876 }
877
878 @SuppressWarnings("unchecked")
879 @Override
880 public final void flush(final Future<T> result) {
881 Future<Object> r = (Future<Object>) result;
882 WaitQueue<Object> q = (Continuation<Object, Object>) this;
883 while (q instanceof Continuation) {
884 final Continuation<Object, Object> c = (Continuation<Object, Object>) q;
885 r = c.apply(r);
886 q = c.safeFlush(r);
887 }
888 if (q != null)
889 q.flush(r);
890 }
891
892 abstract Future<R> apply(Future<T> result);
893
894 @Override
895 protected String toStringPrefix() {
896 return "Continuation";
897 }
898}
899
900final class LinkedContinuation<T, R> {
901

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…