public static JVMClusterUtil.MasterThread createMasterThread(final Configuration c,
    final Class<? extends HMaster> hmc, final int index) throws IOException {
    HMaster server;
    try {
      server = hmc.getConstructor(Configuration.class).newInstance(c);
    } catch (InvocationTargetException ite) {
      Throwable target = ite.getTargetException();
      throw new RuntimeException("Failed construction of Master: " + hmc.toString()
        + ((target.getCause() != null) ? target.getCause().getMessage() : ""), target);
    } catch (Exception e) {
      throw new IOException(e);
    }
    // Needed if a master based registry is configured for internal cluster connections. Here, we
    // just add the current master host port since we do not know other master addresses up front
    // in mini cluster tests.
    c.set(HConstants.MASTER_ADDRS_KEY,
      Preconditions.checkNotNull(server.getServerName().getAddress()).toString());
    return new JVMClusterUtil.MasterThread(server, index);
  }
Creates a {@link MasterThread}. Call 'start' on the returned thread to make it run.
@param c     Configuration to use.
@param hmc   Class to create.
@param index Used distinguishing the object returned.
@return Master added.
hbase-server/src/main/java/org/apache/hadoop/hbase/util/JVMClusterUtil.java