@Override
  public boolean waitForActiveAndReadyMaster(long timeout) throws IOException {
    long start = EnvironmentEdgeManager.currentTime();
    while (EnvironmentEdgeManager.currentTime() - start < timeout) {
      for (JVMClusterUtil.MasterThread mt : getMasterThreads()) {
        if (mt.getMaster().isActiveMaster() && mt.getMaster().isInitialized()) {
          return true;
        }
      }
      Threads.sleep(100);
    }
    return false;
  }
Blocks until there is an active master and that master has completed initialization.
@return true if an active master becomes available. false if there are no masters left.
hbase-server/src/test/java/org/apache/hadoop/hbase/SingleProcessHBaseCluster.java