- AbstractClientConnection(final AbstractClientConnection<T> oldConnection, final int targetQueueSize) {
- this.context = oldConnection.context;
- this.cookie = oldConnection.cookie;
- this.queue = new TransmitQueue.Halted(targetQueueSize);
- this.lastReceivedTicks = oldConnection.lastReceivedTicks;
+ AbstractClientConnection(final AbstractClientConnection<T> oldConn) {
+ this(oldConn, new TransmitQueue.Halted(oldConn.queue, oldConn.currentTime()), oldConn.backendName);
+ }
+
+ // This constructor is only to be called (indirectly) by ConnectedClientConnection constructor.
+ // Do not allow subclassing outside of this package
+ AbstractClientConnection(final AbstractClientConnection<T> oldConn, final T newBackend,
+ final int queueDepth) {
+ this(oldConn, new TransmitQueue.Transmitting(oldConn.queue, queueDepth, newBackend, oldConn.currentTime(),
+ requireNonNull(oldConn.context).messageSlicer()), newBackend.getName());