+ LOG.debug("Connection {} superseded by {}, splicing queue", this, successor);
+
+ /*
+ * We need to account for entries which have been added between the time drain() was called and this method
+ * is invoked. Since the old connection is visible during replay and some entries may have completed on the
+ * replay thread, there was an avenue for this to happen.
+ */
+ int count = 0;
+ ConnectionEntry entry = inflight.poll();
+ while (entry != null) {
+ successor.forwardEntry(entry, now);
+ entry = inflight.poll();
+ count++;
+ }
+
+ entry = pending.poll();
+ while (entry != null) {
+ successor.forwardEntry(entry, now);
+ entry = pending.poll();
+ count++;
+ }
+
+ LOG.debug("Connection {} queue spliced {} messages", this, count);