hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From larsgeo...@apache.org
Subject svn commit: r1501982 - /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftServer.java
Date Wed, 10 Jul 2013 20:46:29 GMT
Author: larsgeorge
Date: Wed Jul 10 20:46:28 2013
New Revision: 1501982

URL: http://svn.apache.org/r1501982
Log:
HBASE-8921 [thrift2] Add GenericOptionsParser to Thrift 2 server

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftServer.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftServer.java?rev=1501982&r1=1501981&r2=1501982&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftServer.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftServer.java
Wed Jul 10 20:46:28 2013
@@ -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.Ca
 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";



Mime
View raw message