@Test public void addAndForward() throws CheckedFutureException { Promise<Integer> p = Promise.apply(); Continuation<Integer, Integer> c = newContinuation(); c.forward(p); p.setValue(1); assertEquals(new Integer(1), get(c)); }
@SuppressWarnings("unchecked") @Override public final void forward(final Promise<T> target) { WaitQueue<T> t = this; while (t instanceof WaitQueueHeadTail) { final WaitQueueHeadTail<T> l = (WaitQueueHeadTail<T>) t; target.continuation(l.head); t = l.tail; } target.continuation((Continuation<T, ?>) t); }
WaitQueueHeadTail implements WaitQueue<T> { @SuppressWarnings("unchecked") @Override public final void forward(final Promise<T> target) { WaitQueue<T> t = this; while (t instanceof WaitQueueHeadTail) { final WaitQueueHeadTail<T> l = (WaitQueueHeadTail<T>) t; target.continuation(l.head); t = l.tail; } target.continuation((Continuation<T, ?>) t); } }
WaitQueueHeadTail implements WaitQueue<T> { @SuppressWarnings("unchecked") @Override public final void forward(final Promise<T> target) { WaitQueue<T> t = this; while (t instanceof WaitQueueHeadTail) { final WaitQueueHeadTail<T> l = (WaitQueueHeadTail<T>) t; target.continuation(l.head); t = l.tail; } target.continuation((Continuation<T, ?>) t); } WaitQueueHeadTail(final Continuation<T, ?> head, final WaitQueue<T> tail); }
WaitQueueHeadTail implements WaitQueue<T> { @SuppressWarnings("unchecked") @Override public final void forward(final Promise<T> target) { WaitQueue<T> t = this; while (t instanceof WaitQueueHeadTail) { final WaitQueueHeadTail<T> l = (WaitQueueHeadTail<T>) t; target.continuation(l.head); t = l.tail; } target.continuation((Continuation<T, ?>) t); } WaitQueueHeadTail(final Continuation<T, ?> head, final WaitQueue<T> tail); @Override final WaitQueue<T> add(final Continuation<T, ?> c); @Override final void flush(final Future<T> result); @SuppressWarnings("unchecked") @Override final void forward(final Promise<T> target); }
WaitQueueHeadTail implements WaitQueue<T> { @SuppressWarnings("unchecked") @Override public final void forward(final Promise<T> target) { WaitQueue<T> t = this; while (t instanceof WaitQueueHeadTail) { final WaitQueueHeadTail<T> l = (WaitQueueHeadTail<T>) t; target.continuation(l.head); t = l.tail; } target.continuation((Continuation<T, ?>) t); } WaitQueueHeadTail(final Continuation<T, ?> head, final WaitQueue<T> tail); @Override final WaitQueue<T> add(final Continuation<T, ?> c); @Override final void flush(final Future<T> result); @SuppressWarnings("unchecked") @Override final void forward(final Promise<T> target);  }