protected SystemMember findSystemMember(GemFireVM vm, boolean compareConfig) {

    SystemMemberImpl member = null;

    synchronized (cacheServerSet) {
      SERVERS: for (final Object o : cacheServerSet) {
        Future future = (Future) o;
        CacheServerImpl cacheServer = null;
        for (;;) {
          checkCancellation();
          boolean interrupted = Thread.interrupted();
          try {
            cacheServer = (CacheServerImpl) future.get();
            break; // success
          } catch (InterruptedException ex) {
            interrupted = true;
            continue; // keep trying
          } catch (CancellationException ex) {
            continue SERVERS;
          } catch (ExecutionException ex) {
            handle(ex);
            continue SERVERS;
          } finally {
            if (interrupted) {
              Thread.currentThread().interrupt();
            }
          }
        } // for

        if (isSame(cacheServer, vm, compareConfig)) {
          member = cacheServer;
          break;
        }
      }
    }

    if (member == null) {
      synchronized (applicationSet) {
        APPS: for (final Object o : applicationSet) {
          Future future = (Future) o;
          SystemMemberImpl application = null;
          for (;;) {
            checkCancellation();
            boolean interrupted = Thread.interrupted();
            try {
              application = (SystemMemberImpl) future.get();
              break; // success
            } catch (InterruptedException ex) {
              interrupted = true;
              continue; // keep trying
            } catch (CancellationException ex) {
              continue APPS;
            } catch (ExecutionException ex) {
              handle(ex);
              continue APPS;
            } finally {
              if (interrupted) {
                Thread.currentThread().interrupt();
              }
            }
          } // for

          if (isSame(application, vm, compareConfig)) {
            member = application;
            break;
          }
        } // APPS
      }
    }

    if (member != null && compareConfig) {
      try {
        member.setGemFireVM(vm);

      } catch (AdminException ex) {
        logger.warn("Could not set the GemFire VM.", ex);
      }
    }

    return member;
  }
Finds and returns the <code>SystemMember</code> that corresponds to the given
<code>GemFireVM</code> or <code>null</code> if no Finds and returns the
<code>SystemMember</code> that corresponds to the given <code>GemFireVM</code> or
<code>null</code> if no <code>SystemMember</code> corresponds.


@param vm GemFireVM instance
@param compareConfig Should the members' configurations be compared? <code>true</code> when the
       member has joined, <code>false</code> when the member has left Should the members'
       configurations be compared? <code>true</code> when the member has joined,
       <code>false</code> when the member has left. Additionally also used to check if system
       member config is to be synchronized with the VM.
geode-core/src/main/java/org/apache/geode/admin/internal/AdminDistributedSystemImpl.java