@Override
  public boolean waitToStop(long timeout) throws InterruptedException {

    if (Thread.interrupted()) {
      throw new InterruptedException();
    }
    long start = System.currentTimeMillis();
    while (System.currentTimeMillis() - start < timeout) {
      synchronized (stateChange) {
        if (state == STOPPED) {
          break;

        } else {
          stateChange.wait(System.currentTimeMillis() - start);
        }
      }
    }

    synchronized (stateChange) {
      return state == STOPPED;
    }
  }
Waits until this system member's "state" is {@link #STOPPED}.
geode-core/src/main/java/org/apache/geode/admin/internal/ManagedSystemMemberImpl.java