Probe immediately when IPs are added to host monitor

rather than waiting for the next polling cycle.

Change-Id: Iffaf50f7a589b52be659b82b8a289e04a5de4ca6
diff --git a/core/net/src/main/java/org/onosproject/net/host/impl/HostMonitor.java b/core/net/src/main/java/org/onosproject/net/host/impl/HostMonitor.java
index 0d2d373..c2bac09 100644
--- a/core/net/src/main/java/org/onosproject/net/host/impl/HostMonitor.java
+++ b/core/net/src/main/java/org/onosproject/net/host/impl/HostMonitor.java
@@ -107,6 +107,7 @@
      */
     void addMonitoringFor(IpAddress ip) {
         monitoredAddresses.add(ip);
+        probe(ip);
     }
 
     /**
@@ -151,28 +152,30 @@
 
     @Override
     public void run(Timeout timeout) throws Exception {
-        for (IpAddress ip : monitoredAddresses) {
-            Set<Host> hosts = hostManager.getHostsByIp(ip);
-
-            if (hosts.isEmpty()) {
-                sendRequest(ip);
-            } else {
-                for (Host host : hosts) {
-                    HostProvider provider = hostProviders.get(host.providerId());
-                    if (provider == null) {
-                        hostProviders.remove(host.providerId(), null);
-                    } else {
-                        provider.triggerProbe(host);
-                    }
-                }
-            }
-        }
+        monitoredAddresses.forEach(this::probe);
 
         synchronized (this) {
             this.timeout = Timer.getTimer().newTimeout(this, probeRate, TimeUnit.MILLISECONDS);
         }
     }
 
+    private void probe(IpAddress ip) {
+        Set<Host> hosts = hostManager.getHostsByIp(ip);
+
+        if (hosts.isEmpty()) {
+            sendRequest(ip);
+        } else {
+            for (Host host : hosts) {
+                HostProvider provider = hostProviders.get(host.providerId());
+                if (provider == null) {
+                    hostProviders.remove(host.providerId(), null);
+                } else {
+                    provider.triggerProbe(host);
+                }
+            }
+        }
+    }
+
     /**
      * Sends an ARP or NDP request for the given IP address.
      *