+
+ // Now replay whatever is in the connection
+ final Iterator<ConnectionEntry> it = enqueuedEntries.iterator();
+ while (it.hasNext()) {
+ final ConnectionEntry e = it.next();
+ final Request<?, ?> req = e.getRequest();
+
+ if (getIdentifier().equals(req.getTarget())) {
+ Verify.verify(req instanceof TransactionRequest, "Unhandled request %s", req);
+ LOG.debug("Forwarding queued request{} to successor {}", req, successor);
+ successor.handleForwardedRemoteRequest((TransactionRequest<?>) req, e.getCallback());
+ it.remove();
+ }
+ }
+
+ /*
+ * Check the state at which we have started the reconnect attempt. State transitions triggered while we were
+ * reconnecting have been forced to slow paths, which will be unlocked once we unblock the state latch
+ * at the end of this method.
+ */
+ final State prevState = local.getPrevState();
+ if (SEALED.equals(prevState)) {
+ LOG.debug("Proxy {} reconnected while being sealed, propagating state to successor {}", this, successor);
+ flushState(successor);
+ successor.ensureSealed();
+ }
+ }
+
+ // Called with the connection locked
+ final void finishReconnect() {
+ final SuccessorState local = getSuccessorState();
+ LOG.debug("Finishing reconnect of proxy {}", this);
+
+ // All done, release the latch, unblocking seal() and canCommit() slow paths
+ local.finish();