コード例 #1
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);
  }
コード例 #2
0
ファイル: HostMonitor.java プロジェクト: rvhub/onos
 /**
  * Registers a host provider with the host monitor. The monitor can use the provider to probe
  * hosts.
  *
  * @param provider the host provider to register
  */
 void registerHostProvider(HostProvider provider) {
   hostProviders.put(provider.id(), provider);
 }