Beispiel #1
0
  /** Refreshes all known discovery managers. */
  private void refreshKnownDiscoveryManagers() {

    this.serviceInfosLock.lock();
    try {
      this.remoteManagersEndpoints.clear();

      // Check all service infos with discovery managers
      for (ServiceInfo serviceInfo : this.serviceInfos) {

        final InetAddress address = serviceInfo.getAddress();
        final int port = serviceInfo.getPort();

        System.out.println("mgr: " + address + " " + port);
        this.remoteManagersEndpoints.add(new RemoteManagerEndpoint(address, port));
      }
    } finally {
      this.serviceInfosLock.unlock();
    }
  }
  /** Refreshes all known discovery managers. */
  private void refreshKnownDiscoveryManagers() {

    this.serviceInfosLock.lock();
    try {
      final List<RemoteManagerEndpoint> endpoints = new ArrayList<RemoteManagerEndpoint>();

      // Check all service infos with discovery managers
      for (final ServiceInfo serviceInfo : this.serviceInfos) {

        final InetAddress address = serviceInfo.getAddress();
        final int port = serviceInfo.getPort();

        endpoints.add(new RemoteManagerEndpoint(address, port));
      }

      // Eventually update the endpoints
      this.remoteManagersEndpoints = endpoints;
    } finally {
      this.serviceInfosLock.unlock();
    }
  }