diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftServer.java index 87b89b5f563..a610bf1b791 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftServer.java @@ -18,6 +18,7 @@ */ package org.apache.hadoop.hbase.thrift2; +import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.UnknownHostException; @@ -46,6 +47,7 @@ import org.apache.hadoop.hbase.thrift.CallQueue.Call; import org.apache.hadoop.hbase.thrift.ThriftMetrics; import org.apache.hadoop.hbase.thrift2.generated.THBaseService; import org.apache.hadoop.hbase.util.InfoServer; +import org.apache.hadoop.util.GenericOptionsParser; import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.protocol.TCompactProtocol; import org.apache.thrift.protocol.TProtocolFactory; @@ -105,9 +107,12 @@ public class ThriftServer { return options; } - private static CommandLine parseArguments(Options options, String[] args) throws ParseException { + private static CommandLine parseArguments(Configuration conf, Options options, String[] args) + throws ParseException, IOException { + GenericOptionsParser genParser = new GenericOptionsParser(conf, args); + String[] remainingArgs = genParser.getRemainingArgs(); CommandLineParser parser = new PosixParser(); - return parser.parse(options, args); + return parser.parse(options, remainingArgs); } private static TProtocolFactory getTProtocolFactory(boolean isCompact) { @@ -222,7 +227,8 @@ public class ThriftServer { TServer server = null; Options options = getOptions(); try { - CommandLine cmd = parseArguments(options, args); + Configuration conf = HBaseConfiguration.create(); + CommandLine cmd = parseArguments(conf, options, args); /** * This is to please both bin/hbase and bin/hbase-daemon. hbase-daemon provides "start" and "stop" arguments hbase @@ -245,7 +251,6 @@ public class ThriftServer { boolean nonblocking = cmd.hasOption("nonblocking"); boolean hsha = cmd.hasOption("hsha"); - Configuration conf = HBaseConfiguration.create(); ThriftMetrics metrics = new ThriftMetrics(conf, ThriftMetrics.ThriftServerType.TWO); String implType = "threadpool";