Merge "Declare reconciliation artifacts"
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / connection / ConnectionContextImpl.java
index cc21a7e8fb9f8feda9bb533dcad66124d378d556..03ad021192ff74989b150d849c67e6ab705423f8 100644 (file)
@@ -1,11 +1,10 @@
-/**
+/*
  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * 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.openflowplugin.impl.connection;
 
 import com.google.common.base.MoreObjects;
@@ -14,7 +13,6 @@ import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.Objects;
 import java.util.Optional;
 import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
@@ -48,7 +46,7 @@ public class ConnectionContextImpl implements ConnectionContext {
     private OutboundQueueHandlerRegistration<OutboundQueueProvider> outboundQueueHandlerRegistration;
     private HandshakeContext handshakeContext;
     private DeviceInfo deviceInfo;
-    private List<PortStatusMessage> portStatusMessages = new ArrayList<>();
+    private final List<PortStatusMessage> portStatusMessages = new ArrayList<>();
 
     /**
      * Constructor.
@@ -101,8 +99,8 @@ public class ConnectionContextImpl implements ConnectionContext {
     }
 
     @Override
-    public void setFeatures(final FeaturesReply featuresReply) {
-        this.featuresReply = featuresReply;
+    public void setFeatures(final FeaturesReply newFeaturesReply) {
+        this.featuresReply = newFeaturesReply;
     }
 
     @Override
@@ -125,8 +123,7 @@ public class ConnectionContextImpl implements ConnectionContext {
 
     private void disconnectDevice(final boolean propagate,
                                   final boolean forced) {
-        final String device =
-                Objects.nonNull(nodeId) ? nodeId.getValue() : getConnectionAdapter().getRemoteAddress().toString();
+        final String device = nodeId != null ? nodeId.getValue() : getConnectionAdapter().getRemoteAddress().toString();
         final short auxiliaryId = Optional
                 .ofNullable(getFeatures())
                 .flatMap(features -> Optional
@@ -165,7 +162,7 @@ public class ConnectionContextImpl implements ConnectionContext {
     }
 
     private void propagateDeviceDisconnectedEvent() {
-        if (Objects.nonNull(deviceDisconnectedHandler)) {
+        if (deviceDisconnectedHandler != null) {
             final BigInteger datapathId = featuresReply != null ? featuresReply.getDatapathId() : BigInteger.ZERO;
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Propagating connection closed event: {}, datapathId:{}.",
@@ -182,13 +179,13 @@ public class ConnectionContextImpl implements ConnectionContext {
      */
     @Override
     public String getSafeNodeIdForLOG() {
-        return Objects.nonNull(nodeId) ? nodeId.getValue() : "null";
+        return nodeId == null ? "null" : nodeId.getValue();
     }
 
     @Override
-    public void setOutboundQueueHandleRegistration(OutboundQueueHandlerRegistration<OutboundQueueProvider>
-                                                               outboundQueueHandlerRegistration) {
-        this.outboundQueueHandlerRegistration = outboundQueueHandlerRegistration;
+    public void setOutboundQueueHandleRegistration(
+            OutboundQueueHandlerRegistration<OutboundQueueProvider> newRegistration) {
+        this.outboundQueueHandlerRegistration = newRegistration;
     }
 
     private void unregisterOutboundQueue() {
@@ -288,7 +285,7 @@ public class ConnectionContextImpl implements ConnectionContext {
         return result;
     }
 
-    private class DeviceInfoImpl implements DeviceInfo {
+    private static class DeviceInfoImpl implements DeviceInfo {
 
         private final NodeId nodeId;
         private final KeyedInstanceIdentifier<Node, NodeKey> nodeII;
@@ -348,10 +345,10 @@ public class ConnectionContextImpl implements ConnectionContext {
 
             DeviceInfoImpl that = (DeviceInfoImpl) object;
 
-            return  (nodeId.equals(that.nodeId)
+            return  nodeId.equals(that.nodeId)
                     && nodeII.equals(that.nodeII)
                     && version.equals(that.version)
-                    && datapathId.equals(that.datapathId));
+                    && datapathId.equals(that.datapathId);
 
         }
 
@@ -366,7 +363,7 @@ public class ConnectionContextImpl implements ConnectionContext {
 
         @Override
         public String toString() {
-            return Objects.isNull(nodeId) ? "null" : getNodeId().getValue();
+            return nodeId == null ? "null" : getNodeId().getValue();
         }
 
         public void setOutboundQueueProvider(final OutboundQueue outboundQueueProvider) {