Added hosttracker shell for karaf (rebased)
[controller.git] / opendaylight / hosttracker / implementation / src / main / java / org / opendaylight / controller / hosttracker / internal / HostTrackerCallable.java
index 06311a5206268ae79fe8ebe32970a395423cf162..a1d29dd27fe014696db69b0e08cadff297465d3b 100644 (file)
@@ -18,19 +18,24 @@ package org.opendaylight.controller.hosttracker.internal;
  * find a host in HostTracker's database and want to discover the host
  * in the same thread without being called by a callback function.
  */
-import java.net.InetAddress;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
 
+import org.opendaylight.controller.hosttracker.IHostId;
 import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
 
+/**
+ *
+ *
+ */
 public class HostTrackerCallable implements Callable<HostNodeConnector> {
 
-    InetAddress trackedHost;
+    //host id which could be ip or a combination of ip + mac based on the scheme chosen.
+    IHostId trackedHost;
     HostTracker hostTracker;
     protected CountDownLatch latch;
 
-    public HostTrackerCallable(HostTracker tracker, InetAddress inet) {
+    public HostTrackerCallable(HostTracker tracker, IHostId inet) {
         trackedHost = inet;
         hostTracker = tracker;
         latch = new CountDownLatch(1);
@@ -42,7 +47,7 @@ public class HostTrackerCallable implements Callable<HostNodeConnector> {
         if (h != null)
             return h;
         hostTracker.setCallableOnPendingARP(trackedHost, this);
-        latch.await();
+        Thread.sleep(2000); // wait 2sec to see if the host responds
         return hostTracker.hostQuery(trackedHost);
     }