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

Class WaitQueueHeadTail

future-java/src/main/java/io/trane/future/WaitQueue.java:12–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10}
11
12final class WaitQueueHeadTail<T> implements WaitQueue<T> {
13
14 private final Continuation<T, ?> head;
15 private final WaitQueue<T> tail;
16
17 WaitQueueHeadTail(final Continuation<T, ?> head, final WaitQueue<T> tail) {
18 this.head = head;
19 this.tail = tail;
20 }
21
22 @Override
23 public final WaitQueue<T> add(final Continuation<T, ?> c) {
24 return new WaitQueueHeadTail<>(c, this);
25 }
26
27 @Override
28 public final void flush(final Future<T> result) {
29 WaitQueue<T> t = this;
30 while (t instanceof WaitQueueHeadTail) {
31 final WaitQueueHeadTail<T> l = (WaitQueueHeadTail<T>) t;
32 l.head.flush(result);
33 t = l.tail;
34 }
35 t.flush(result);
36 }
37
38 @SuppressWarnings("unchecked")
39 @Override
40 public final void forward(final Promise<T> target) {
41 WaitQueue<T> t = this;
42 while (t instanceof WaitQueueHeadTail) {
43 final WaitQueueHeadTail<T> l = (WaitQueueHeadTail<T>) t;
44 target.continuation(l.head);
45 t = l.tail;
46 }
47 target.continuation((Continuation<T, ?>) t);
48 }
49}

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…