Use ByteBuf.readRetainedSlice()
[openflowplugin.git] / openflowjava / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / core / connection / AbstractOutboundQueueManager.java
index f07895b44b902858a04496338b94e1283d1d334c..27ba9cdd933171a983c8eea96f2c1be7ab797c29 100644 (file)
@@ -5,10 +5,12 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowjava.protocol.impl.core.connection;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelInboundHandlerAdapter;
 import io.netty.util.concurrent.Future;
@@ -82,9 +84,11 @@ abstract class AbstractOutboundQueueManager<T extends OutboundQueueHandler, O ex
     // Passed to executor to request triggering of flush
     protected final Runnable flushRunnable = this::flush;
 
+    @SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR",
+        justification = "Circular dependency on outbound queue")
     AbstractOutboundQueueManager(final ConnectionAdapterImpl parent, final InetSocketAddress address, final T handler) {
-        this.parent = Preconditions.checkNotNull(parent);
-        this.handler = Preconditions.checkNotNull(handler);
+        this.parent = requireNonNull(parent);
+        this.handler = requireNonNull(handler);
         this.address = address;
         /* Note: don't wish to use reflection here */
         currentQueue = initializeStackedOutboudnqueue();
@@ -261,8 +265,7 @@ abstract class AbstractOutboundQueueManager<T extends OutboundQueueHandler, O ex
      * selected by communication pipeline.
      */
     protected Object makeMessageListenerWrapper(@NonNull final OfHeader msg) {
-        Preconditions.checkArgument(msg != null);
-
+        checkArgument(msg != null);
         if (address == null) {
             return new MessageListenerWrapper(msg, LOG_ENCODER_LISTENER);
         }