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

Method proxyTo

future-java/src/main/java/io/trane/future/Promise.java:780–797  ·  view source on GitHub ↗
(final Promise<T> p)

Source from the content-addressed store, hash-verified

778 }
779
780 @Override
781 public final void proxyTo(final Promise<T> p) {
782 if (p.isDefined())
783 throw new IllegalStateException("Cannot call proxyTo on an already satisfied Promise.");
784
785 final Responder<T> r = new Responder<T>() {
786 @Override
787 public final void onException(final Throwable ex) {
788 p.setException(ex);
789 }
790
791 @Override
792 public final void onValue(final T value) {
793 p.setValue(value);
794 }
795 };
796 respond(r);
797 }
798
799 private static final class WithinPromise<T> extends Promise<T> implements Responder<T>, Runnable {
800

Callers 1

interruptibleMethod · 0.95

Calls 2

respondMethod · 0.95
isDefinedMethod · 0.65

Tested by

no test coverage detected