public String waitOnMaster(JVMClusterUtil.MasterThread masterThread) {
    boolean interrupted = false;
    while (masterThread.isAlive()) {
      try {
        LOG.info("Waiting on " + masterThread.getMaster().getServerName().toString());
        masterThread.join();
      } catch (InterruptedException e) {
        LOG.error("Interrupted while waiting for {} to finish. Retrying join",
          masterThread.getName(), e);
        interrupted = true;
      }
    }
    masterThreads.remove(masterThread);
    if (interrupted) {
      Thread.currentThread().interrupt();
    }
    return masterThread.getName();
  }
Wait for the specified master to stop. Removes this thread from list of running threads.
@return Name of master that just went down.
hbase-server/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java