public void stop(boolean forcedDisconnect, boolean stopForReconnect, boolean waitForDisconnect) {
    boolean isDebugEnabled = logger.isDebugEnabled();

    stoppedForReconnect = stopForReconnect;
    this.forcedDisconnect = forcedDisconnect;

    if (membershipLocator.isShuttingDown()) {
      // fix for bug 46156
      // If we are already shutting down don't do all of this again.
      // But, give the server a bit of time to shut down so a new
      // locator can be created, if desired, when this method returns
      if (waitForDisconnect) {
        long endOfWait = System.currentTimeMillis() + 60000;
        if (isDebugEnabled && membershipLocator.isAlive()) {
          logger.debug("sleeping to wait for the locator server to shut down...");
        }

        while (membershipLocator.isAlive() && System.currentTimeMillis() < endOfWait) {
          try {
            Thread.sleep(500);
          } catch (InterruptedException ignored) {
            Thread.currentThread().interrupt();
            return;
          }
        }

        if (isDebugEnabled) {
          if (membershipLocator.isAlive()) {
            logger.debug(
                "60 seconds have elapsed waiting for the locator server to shut down - terminating wait and returning");
          } else {
            logger.debug("the locator server has shut down");
          }
        }
      }
    }

    if (locatorDiscoverer != null) {
      locatorDiscoverer.stop();
      locatorDiscoverer = null;
    }

    // stop the TCPServer
    if (!membershipLocator.isShuttingDown()) {
      membershipLocator.stop();
    }

    removeLocator(this);

    handleShutdown();
    logger.info("{} is stopped", this);

    if (stopForReconnect) {
      launchRestartThread();
    }
  }
Stop this locator

@param stopForReconnect - stopping for distributed system reconnect
@param waitForDisconnect - wait up to 60 seconds for the locator to completely stop
geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java