/** Starts the host monitor. Does nothing if the monitor is already running. */ void start() { synchronized (this) { if (timeout == null) { timeout = Timer.getTimer().newTimeout(this, 0, TimeUnit.MILLISECONDS); } } }
@Override public void run(Timeout timeout) throws Exception { for (IpAddress ip : monitoredAddresses) { Set<Host> hosts = hostManager.getHostsByIp(ip); if (hosts.isEmpty()) { sendArpNdpRequest(ip); } else { for (Host host : hosts) { HostProvider provider = hostProviders.get(host.providerId()); if (provider == null) { hostProviders.remove(host.providerId(), null); } else { provider.triggerProbe(host); } } } } this.timeout = Timer.getTimer().newTimeout(this, probeRate, TimeUnit.MILLISECONDS); }