예제 #1
0
파일: HostMonitor.java 프로젝트: rvhub/onos
 /** 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);
     }
   }
 }
예제 #2
0
파일: HostMonitor.java 프로젝트: rvhub/onos
  @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);
  }