code: public void stop() throws Exception {
      if (mSecondaryMasterThread != null) {
        mSecondaryMaster.stop();
        while (mSecondaryMasterThread.isAlive()) {
          LOG.info("Stopping thread {}.", mSecondaryMasterThread.getName());
          mSecondaryMasterThread.join(1000);
        }
        mSecondaryMasterThread = null;
      }
      if (mMasterThread != null) {
        mMasterProcess.stop();
        while (mMasterThread.isAlive()) {
          LOG.info("Stopping thread {}.", mMasterThread.getName());
          mMasterThread.interrupt();
          mMasterThread.join(1000);
        }
        mMasterThread = null;
      }
      clearClients();
      System.clearProperty("alluxio.web.resources");
      System.clearProperty("alluxio.master.min.worker.threads");
    }
docs: Stops the master processes and cleans up client connections.