HBASE-6998 Uncaught exception in main() makes the HMaster/HRegionServer process suspend (Liang Xie)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1400940 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2012-10-22 16:27:16 +00:00
parent 77707f9b0a
commit b27d0319c0
3 changed files with 11 additions and 7 deletions

View File

@ -2294,7 +2294,7 @@ Server {
/** /**
* @see org.apache.hadoop.hbase.master.HMasterCommandLine * @see org.apache.hadoop.hbase.master.HMasterCommandLine
*/ */
public static void main(String [] args) throws Exception { public static void main(String [] args) {
VersionInfo.logVersion(); VersionInfo.logVersion();
new HMasterCommandLine(HMaster.class).doMain(args); new HMasterCommandLine(HMaster.class).doMain(args);
} }

View File

@ -73,11 +73,15 @@ public abstract class ServerCommandLine extends Configured implements Tool {
* Parse and run the given command line. This may exit the JVM if * Parse and run the given command line. This may exit the JVM if
* a nonzero exit code is returned from <code>run()</code>. * a nonzero exit code is returned from <code>run()</code>.
*/ */
public void doMain(String args[]) throws Exception { public void doMain(String args[]) {
int ret = ToolRunner.run( try {
HBaseConfiguration.create(), this, args); int ret = ToolRunner.run(HBaseConfiguration.create(), this, args);
if (ret != 0) { if (ret != 0) {
System.exit(ret); System.exit(ret);
} }
} catch (Exception e) {
LOG.error("Failed to run", e);
System.exit(-1);
}
} }
} }

View File

@ -59,7 +59,7 @@ public class OOMERegionServer extends HRegionServer {
} }
} }
public static void main(String[] args) throws Exception { public static void main(String[] args) {
new HRegionServerCommandLine(OOMERegionServer.class).doMain(args); new HRegionServerCommandLine(OOMERegionServer.class).doMain(args);
} }
} }