Remove commented out code to fix sonar warnings
[controller.git] / opendaylight / hosttracker / implementation / src / main / java / org / opendaylight / controller / hosttracker / internal / HostTracker.java
index 9f0cd893b09902a2781fb82480cee345413847b4..3f3f76e09486c7f3319129aaf649f19babec27ca 100644 (file)
@@ -106,6 +106,8 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw
     private String containerName = null;
     private ExecutorService executor;
     protected boolean stopping;
+    private static boolean hostRefresh = true;
+    private static int hostRetryCount = 5;
     private static class ARPPending {
         protected InetAddress hostIP;
         protected short sent_count;
@@ -694,9 +696,9 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw
         int num = 1;
         for (ArrayList<String> hierarchy : hierarchies) {
             StringBuffer buf = new StringBuffer();
-            buf.append("Hierarchy#" + num + " : ");
+            buf.append("Hierarchy#").append(num).append(" : ");
             for (String switchName : hierarchy) {
-                buf.append(switchName + "/");
+                buf.append(switchName).append("/");
             }
             logger.debug("{} -> {}", getContainerName(), buf);
             num++;
@@ -771,7 +773,6 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw
      */
     @SuppressWarnings("unchecked")
     private void updateCurrentHierarchy(Node node, ArrayList<String> currHierarchy, List<List<String>> fullHierarchy) {
-        // currHierarchy.add(String.format("%x", currSw.getId()));
         currHierarchy.add(dpidToHostNameHack((Long) node.getID()));
         // Shallow copy as required
         ArrayList<String> currHierarchyClone = (ArrayList<String>) currHierarchy.clone();
@@ -933,7 +934,7 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw
                     ARPPendingList.remove(entry.getKey());
                     continue;
                 }
-                if (arphost.getSent_count() < switchManager.getHostRetryCount()) {
+                if (arphost.getSent_count() < hostRetryCount) {
                     /*
                      * No reply has been received of first ARP Req, send the
                      * next one. Before sending the ARP, check if ARPHandler is
@@ -946,7 +947,7 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw
                     hostFinder.find(arphost.getHostIP());
                     arphost.sent_count++;
                     logger.debug("ARP Sent from ARPPending List, IP: {}", arphost.getHostIP().getHostAddress());
-                } else if (arphost.getSent_count() >= switchManager.getHostRetryCount()) {
+                } else if (arphost.getSent_count() >= hostRetryCount) {
                     /*
                      * ARP requests have been sent without receiving a reply,
                      * remove this from the pending list
@@ -977,9 +978,9 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw
             if ((clusterContainerService != null) && !clusterContainerService.amICoordinator()) {
                 return;
             }
-            if ((switchManager != null) && !switchManager.isHostRefreshEnabled()) {
+            if (!hostRefresh) {
                 /*
-                 * The host probe procedure was disabled by CLI
+                 * The host probe procedure is turned off
                  */
                 return;
             }
@@ -997,7 +998,7 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw
 
                 short arp_cntdown = host.getArpSendCountDown();
                 arp_cntdown--;
-                if (arp_cntdown > switchManager.getHostRetryCount()) {
+                if (arp_cntdown > hostRetryCount) {
                     host.setArpSendCountDown(arp_cntdown);
                 } else if (arp_cntdown <= 0) {
                     /*
@@ -1006,7 +1007,7 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw
                      */
                     removeKnownHost(entry.getKey());
                     notifyHostLearnedOrRemoved(host, false);
-                } else if (arp_cntdown <= switchManager.getHostRetryCount()) {
+                } else if (arp_cntdown <= hostRetryCount) {
                     /*
                      * Use the services of arphandler to check if host is still
                      * there