+ // Private constructor to avoid code duplication.
+ private AbstractClientConnection(final AbstractClientConnection<T> oldConn, final TransmitQueue newQueue,
+ final String backendName) {
+ context = oldConn.context;
+ cookie = oldConn.cookie;
+ this.backendName = requireNonNull(backendName);
+ queue = requireNonNull(newQueue);
+ // Will be updated in finishReplay if needed.
+ lastReceivedTicks = oldConn.lastReceivedTicks;
+ }
+
+ // This constructor is only to be called by ConnectingClientConnection constructor.
+ // Do not allow subclassing outside of this package
+ AbstractClientConnection(final ClientActorContext context, final Long cookie, final String backendName,
+ final int queueDepth) {
+ this.context = requireNonNull(context);
+ this.cookie = requireNonNull(cookie);
+ this.backendName = requireNonNull(backendName);
+ queue = new TransmitQueue.Halted(queueDepth);
+ lastReceivedTicks = currentTime();
+ }
+
+ // This constructor is only to be called (indirectly) by ReconnectingClientConnection constructor.