HBASE-11081 Trunk Master won't start; looking for Constructor that takes conf only

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1590154 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2014-04-25 21:31:42 +00:00
parent ca303c699d
commit fe298e08d3
2 changed files with 6 additions and 4 deletions

View File

@ -1752,11 +1752,11 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
* @return HMaster instance. * @return HMaster instance.
*/ */
public static HMaster constructMaster(Class<? extends HMaster> masterClass, public static HMaster constructMaster(Class<? extends HMaster> masterClass,
final Configuration conf) { final Configuration conf, final ConsensusProvider cp) {
try { try {
Constructor<? extends HMaster> c = Constructor<? extends HMaster> c =
masterClass.getConstructor(Configuration.class); masterClass.getConstructor(Configuration.class, ConsensusProvider.class);
return c.newInstance(conf); return c.newInstance(conf, cp);
} catch (InvocationTargetException ite) { } catch (InvocationTargetException ite) {
Throwable target = ite.getTargetException() != null? Throwable target = ite.getTargetException() != null?
ite.getTargetException(): ite; ite.getTargetException(): ite;

View File

@ -37,6 +37,7 @@ import org.apache.hadoop.hbase.LocalHBaseCluster;
import org.apache.hadoop.hbase.ZooKeeperConnectionException; import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.consensus.ConsensusProvider; import org.apache.hadoop.hbase.consensus.ConsensusProvider;
import org.apache.hadoop.hbase.consensus.ConsensusProviderFactory;
import org.apache.hadoop.hbase.regionserver.HRegionServer; import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.util.JVMClusterUtil; import org.apache.hadoop.hbase.util.JVMClusterUtil;
import org.apache.hadoop.hbase.util.ServerCommandLine; import org.apache.hadoop.hbase.util.ServerCommandLine;
@ -186,7 +187,8 @@ public class HMasterCommandLine extends ServerCommandLine {
waitOnMasterThreads(cluster); waitOnMasterThreads(cluster);
} else { } else {
logProcessInfo(getConf()); logProcessInfo(getConf());
HMaster master = HMaster.constructMaster(masterClass, conf); ConsensusProvider cp = ConsensusProviderFactory.getConsensusProvider(conf);
HMaster master = HMaster.constructMaster(masterClass, conf, cp);
if (master.isStopped()) { if (master.isStopped()) {
LOG.info("Won't bring the Master up as a shutdown is requested"); LOG.info("Won't bring the Master up as a shutdown is requested");
return 1; return 1;