Merge "Gracefully stop HT threads when the bundle is being stopped (cache terminated...
[controller.git] / opendaylight / hosttracker / api / src / main / java / org / opendaylight / controller / hosttracker / hostAware / HostNodeConnector.java
index e7b5745a2ec63c3fc3544d3b538e1d5188154303..f3f86a56e2b16f70441a0794a88b957f4fae9015 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
  *
@@ -19,14 +18,13 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
 import org.opendaylight.controller.sal.core.ConstructionException;
 import org.opendaylight.controller.sal.core.Host;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.packet.address.EthernetAddress;
 
-@XmlRootElement(name="host")
+@XmlRootElement(name = "host")
 @XmlAccessorType(XmlAccessType.NONE)
 public class HostNodeConnector extends Host {
     private static final long serialVersionUID = 1L;
@@ -36,7 +34,7 @@ public class HostNodeConnector extends Host {
     private short vlan;
     @XmlElement
     private boolean staticHost;
-    private transient short arpSendCountDown;
+    private short arpSendCountDown;
 
     /**
      * Private constructor used for JAXB mapping
@@ -82,20 +80,6 @@ public class HostNodeConnector extends Host {
         return this.nodeConnector.getNode();
     }
 
-    /**
-     * @return the NodeId
-     */
-    public Long getnodeconnectornodeId() {
-        return (Long) this.nodeConnector.getNode().getID();
-    }
-
-    /**
-     * @return the port
-     */
-    public Short getnodeconnectorportId() {
-        return (Short) this.nodeConnector.getID();
-    }
-
     /**
      * @return the DataLayerAddress
      */
@@ -151,22 +135,29 @@ public class HostNodeConnector extends Host {
 
     @Override
     public boolean equals(Object obj) {
-        if (this == obj)
+        if (this == obj) {
             return true;
-        if (!super.equals(obj))
+        }
+        if (!super.equals(obj)) {
             return false;
-        if (getClass() != obj.getClass())
+        }
+        if (getClass() != obj.getClass()) {
             return false;
+        }
         HostNodeConnector other = (HostNodeConnector) obj;
         if (nodeConnector == null) {
-            if (other.nodeConnector != null)
+            if (other.nodeConnector != null) {
                 return false;
-        } else if (!nodeConnector.equals(other.nodeConnector))
+            }
+        } else if (!nodeConnector.equals(other.nodeConnector)) {
             return false;
-        if (staticHost != other.staticHost)
+        }
+        if (staticHost != other.staticHost) {
             return false;
-        if (vlan != other.vlan)
+        }
+        if (vlan != other.vlan) {
             return false;
+        }
         return true;
     }
 
@@ -182,18 +173,34 @@ public class HostNodeConnector extends Host {
             EthernetAddress e = (EthernetAddress) getDataLayerAddress();
             macaddr = e.getValue();
         }
-        if (macaddr == null)
+        if (macaddr == null) {
             return false;
+        }
         return !Arrays.equals(emptyArray, macaddr);
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     *
      * @see java.lang.Object#toString()
      */
     @Override
     public String toString() {
-        return "HostNodeConnector[" + ReflectionToStringBuilder.toString(this)
-                + "]";
+        StringBuilder builder = new StringBuilder();
+        builder.append("HostNodeConnector [");
+        if (nodeConnector != null) {
+            builder.append("nodeConnector=")
+                    .append(nodeConnector)
+                    .append(", ");
+        }
+        builder.append("vlan=")
+                .append(vlan)
+                .append(", staticHost=")
+                .append(staticHost)
+                .append(", arpSendCountDown=")
+                .append(arpSendCountDown)
+                .append("]");
+        return builder.toString();
     }
 
     public boolean isV4Host() {