private RemoteApplicationVM addMember(InternalDistributedMember id) {
    boolean runFuture = false;
    Future<RemoteApplicationVM> future;
    synchronized (membersLock) {
      Map<InternalDistributedMember, Future<RemoteApplicationVM>> oldMembersMap = membersMap;
      future = oldMembersMap.get(id);
      if (future == null) {
        runFuture = true;
        if (abortCurrentJoin) {
          return null;
        }
        future = new FutureTask<>(() -> {
          // Do this work in a Future to avoid deadlock
          RemoteGfManagerAgent agent = this;
          RemoteApplicationVM result = new RemoteApplicationVM(agent, id, alertLevel);
          result.startStatDispatcher();
          if (agent.abortCurrentJoin) {
            result.stopStatListening();
            return null;
          }
          return result;
        });
        Map<InternalDistributedMember, Future<RemoteApplicationVM>> newMembersMap =
            new HashMap<>(oldMembersMap);
        newMembersMap.put(id, future);
        if (abortCurrentJoin) {
          return null;
        }
        membersMap = newMembersMap;
      }
    }

    if (runFuture) {
      // Run future outside of membersLock
      ((Runnable) future).run();
    }

    for (;;) {
      system.getCancelCriterion().checkCancelInProgress(null);
      boolean interrupted = Thread.interrupted();
      try {
        return future.get();
      } catch (InterruptedException ex) {
        interrupted = true;
      } catch (CancellationException ex) {
        return null;
      } catch (ExecutionException ex) {
        handle(ex);
        return null;
      } finally {
        if (interrupted) {
          Thread.currentThread().interrupt();
        }
      }
    }
  }
Returns a representation of the application VM with the given distributed system id. If there
does not already exist a representation for that member, a new one is created.
geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteGfManagerAgent.java