HBASE-5193 Use TBoundedThreadPoolServer in HRegionThriftServer

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1231347 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2012-01-13 22:23:52 +00:00
parent ee03d1626d
commit 0876497eb9
1 changed files with 7 additions and 5 deletions

View File

@ -34,17 +34,18 @@ import org.apache.hadoop.hbase.NotServingRegionException;
import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.thrift.ThriftServer;
import org.apache.hadoop.hbase.thrift.ThriftUtilities;
import org.apache.hadoop.hbase.thrift.generated.Hbase; import org.apache.hadoop.hbase.thrift.generated.Hbase;
import org.apache.hadoop.hbase.thrift.generated.IOError; import org.apache.hadoop.hbase.thrift.generated.IOError;
import org.apache.hadoop.hbase.thrift.generated.TRowResult; import org.apache.hadoop.hbase.thrift.generated.TRowResult;
import org.apache.hadoop.hbase.thrift.TBoundedThreadPoolServer;
import org.apache.hadoop.hbase.thrift.TBoundedThreadPoolServer.Args;
import org.apache.hadoop.hbase.thrift.ThriftServer;
import org.apache.hadoop.hbase.thrift.ThriftUtilities;
import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TCompactProtocol; import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.protocol.TProtocolFactory; import org.apache.thrift.protocol.TProtocolFactory;
import org.apache.thrift.server.TNonblockingServer; import org.apache.thrift.server.TNonblockingServer;
import org.apache.thrift.server.TServer; import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TThreadPoolServer;
import org.apache.thrift.transport.TFramedTransport; import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TNonblockingServerSocket; import org.apache.thrift.transport.TNonblockingServerSocket;
import org.apache.thrift.transport.TNonblockingServerTransport; import org.apache.thrift.transport.TNonblockingServerTransport;
@ -225,13 +226,14 @@ public class HRegionThriftServer extends Thread {
transportFactory = new TTransportFactory(); transportFactory = new TTransportFactory();
} }
TThreadPoolServer.Args serverArgs = new TThreadPoolServer.Args(serverTransport); TBoundedThreadPoolServer.Args serverArgs =
new TBoundedThreadPoolServer.Args(serverTransport, conf);
serverArgs.processor(processor); serverArgs.processor(processor);
serverArgs.protocolFactory(protocolFactory); serverArgs.protocolFactory(protocolFactory);
serverArgs.transportFactory(transportFactory); serverArgs.transportFactory(transportFactory);
LOG.info("starting HRegionServer ThreadPool Thrift server on " + LOG.info("starting HRegionServer ThreadPool Thrift server on " +
listenAddress + ":" + this.port); listenAddress + ":" + this.port);
tserver = new TThreadPoolServer(serverArgs); tserver = new TBoundedThreadPoolServer(serverArgs);
} }
tserver.serve(); tserver.serve();
} catch (Exception e) { } catch (Exception e) {