public HMaster getActiveMaster() {
    for (JVMClusterUtil.MasterThread mt : masterThreads) {
      // Ensure that the current active master is not stopped.
      // We don't want to return a stopping master as an active master.
      if (mt.getMaster().isActiveMaster() && !mt.getMaster().isStopped()) {
        return mt.getMaster();
      }
    }
    return null;
  }
Gets the current active master, if available. If no active master, returns null.
@return the HMaster for the active master
hbase-server/src/main/java/org/apache/hadoop/hbase/LocalHBaseCluster.java