+ /**
+ * Drain the contents of the connection into a list. This will leave the queue empty and allow further entries
+ * to be added to it during replay. When we set the successor all entries enqueued between when this methods
+ * returns and the successor is set will be replayed to the successor.
+ *
+ * @return Collection of entries present in the queue.
+ */
+ final Collection<ConnectionEntry> drain() {
+ final Collection<ConnectionEntry> ret = new ArrayDeque<>(inflight.size() + pending.size());
+ ret.addAll(inflight);
+ ret.addAll(pending);
+ inflight.clear();
+ pending.clear();
+ return ret;
+ }
+
+ final long ticksStalling(final long now) {
+ return tracker.ticksStalling(now);
+ }
+
+ final boolean hasSuccessor() {
+ return successor != null;
+ }
+
+ // If a matching request was found, this will track a task was closed.
+ final Optional<TransmittedConnectionEntry> complete(final ResponseEnvelope<?> envelope, final long now) {