Bug 5280: Add ProgressTracker
[controller.git] / opendaylight / md-sal / cds-access-client / src / main / java / org / opendaylight / controller / cluster / access / client / ConnectingClientConnection.java
index cdadf1d6012dee2e85dae1a0e41f93c31e0e6aea..aa986873d57e03f841e27986d24f57fa5e9cf402 100644 (file)
@@ -9,17 +9,19 @@ package org.opendaylight.controller.cluster.access.client;
 
 import com.google.common.annotations.Beta;
 import java.util.Optional;
-import org.opendaylight.controller.cluster.access.concepts.ResponseEnvelope;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @Beta
 public final class ConnectingClientConnection<T extends BackendInfo> extends AbstractClientConnection<T> {
-    private static final Logger LOG = LoggerFactory.getLogger(ConnectingClientConnection.class);
+    /**
+     * A wild estimate on how deep a queue should be. Without having knowledge of the remote actor we can only
+     * guess its processing capabilities while we are doing initial buffering. With {@link AveragingProgressTracker}
+     * this boils down to a burst of up to 2000 messages before we start throttling.
+     */
+    private static final int TARGET_QUEUE_DEPTH = 4000;
 
     // Initial state, never instantiated externally
     ConnectingClientConnection(final ClientActorContext context, final Long cookie) {
-        super(context, cookie);
+        super(context, cookie, new TransmitQueue.Halted(TARGET_QUEUE_DEPTH));
     }
 
     @Override
@@ -27,11 +29,6 @@ public final class ConnectingClientConnection<T extends BackendInfo> extends Abs
         return Optional.empty();
     }
 
-    @Override
-    void receiveResponse(final ResponseEnvelope<?> envelope) {
-        LOG.warn("Initial connection {} ignoring response {}", this, envelope);
-    }
-
     @Override
     ClientActorBehavior<T> reconnectConnection(final ClientActorBehavior<T> current) {
         throw new UnsupportedOperationException("Attempted to reconnect a connecting connection");