本文整理汇总了Java中com.facebook.thrift.transport.TServerTransport类的典型用法代码示例。如果您正苦于以下问题:Java TServerTransport类的具体用法?Java TServerTransport怎么用?Java TServerTransport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TServerTransport类属于com.facebook.thrift.transport包,在下文中一共展示了TServerTransport类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HadoopThriftServer
import com.facebook.thrift.transport.TServerTransport; //导入依赖的package包/类
/**
* Constrcts a server object
*/
public HadoopThriftServer(String [] args) {
if (args.length > 0) {
serverPort = new Integer(args[0]);
}
try {
ServerSocket ssock = createServerSocket(serverPort);
TServerTransport serverTransport = new TServerSocket(ssock);
Iface handler = new HadoopThriftHandler("hdfs-thrift-dhruba");
ThriftHadoopFileSystem.Processor processor = new ThriftHadoopFileSystem.Processor(handler);
TThreadPoolServer.Options options = new TThreadPoolServer.Options();
options.minWorkerThreads = 10;
server = new TThreadPoolServer(processor, serverTransport,
new TTransportFactory(),
new TTransportFactory(),
new TBinaryProtocol.Factory(),
new TBinaryProtocol.Factory(),
options);
System.out.println("Starting the hadoop thrift server on port [" + serverPort + "]...");
HadoopThriftHandler.LOG.info("Starting the hadoop thrift server on port [" +serverPort + "]...");
System.out.flush();
} catch (Exception x) {
x.printStackTrace();
}
}