use of org.apache.thrift.server.TThreadedSelectorServer in project summer by foxsugar.
the class GameRpcServer method StartServer.
public static TServer StartServer(int port, GameRPCNew.AsyncIface iface) throws TTransportException {
TServer server = null;
try {
TProcessor tprocessor = new GameRPCNew.AsyncProcessor<>(iface);
TNonblockingServerSocket serverTransport = null;
serverTransport = new TNonblockingServerSocket(port);
TThreadedSelectorServer.Args tArgs = new TThreadedSelectorServer.Args(serverTransport);
tArgs.maxReadBufferBytes = 1024 * 1024L;
tArgs.processor(tprocessor);
tArgs.transportFactory(new TFramedTransport.Factory());
tArgs.protocolFactory(new TBinaryProtocol.Factory());
server = new TThreadedSelectorServer(tArgs);
server.serve();
} catch (Exception e) {
System.out.println("-------------------------------------");
e.printStackTrace();
}
return server;
}
use of org.apache.thrift.server.TThreadedSelectorServer in project summer by foxsugar.
the class GameRpcServer method StartServer.
public static TServer StartServer(int port, GameRPC.AsyncIface iface) throws TTransportException {
TServer server = null;
try {
TProcessor tprocessor = new GameRPC.AsyncProcessor<>(iface);
TNonblockingServerSocket serverTransport = null;
serverTransport = new TNonblockingServerSocket(port);
TThreadedSelectorServer.Args tArgs = new TThreadedSelectorServer.Args(serverTransport);
tArgs.maxReadBufferBytes = 1024 * 1024L;
tArgs.processor(tprocessor);
tArgs.transportFactory(new TFramedTransport.Factory());
tArgs.protocolFactory(new TBinaryProtocol.Factory());
server = new TThreadedSelectorServer(tArgs);
server.serve();
} catch (Exception e) {
System.out.println("-------------------------------------");
e.printStackTrace();
}
return server;
}
use of org.apache.thrift.server.TThreadedSelectorServer in project hbase by apache.
the class ThriftServer method getTThreadedSelectorServer.
private static TServer getTThreadedSelectorServer(TProtocolFactory protocolFactory, TProcessor processor, TTransportFactory transportFactory, int workerThreads, int selectorThreads, int maxCallQueueSize, InetSocketAddress inetSocketAddress, ThriftMetrics metrics) throws TTransportException {
TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(inetSocketAddress);
log.info("starting HBase ThreadedSelector Thrift server on " + inetSocketAddress.toString());
TThreadedSelectorServer.Args serverArgs = new TThreadedSelectorServer.Args(serverTransport);
if (workerThreads > 0) {
serverArgs.workerThreads(workerThreads);
}
if (selectorThreads > 0) {
serverArgs.selectorThreads(selectorThreads);
}
ExecutorService executorService = createExecutor(workerThreads, maxCallQueueSize, metrics);
serverArgs.executorService(executorService);
serverArgs.processor(processor);
serverArgs.transportFactory(transportFactory);
serverArgs.protocolFactory(protocolFactory);
return new TThreadedSelectorServer(serverArgs);
}
use of org.apache.thrift.server.TThreadedSelectorServer in project lucida by claritylab.
the class CalendarDaemon method main.
public static void main(String[] args) throws TTransportException, IOException, InterruptedException {
TProcessor proc = new LucidaService.AsyncProcessor(new CAServiceHandler.AsyncCAServiceHandler());
TNonblockingServerTransport transport = new TNonblockingServerSocket(8084);
TThreadedSelectorServer.Args arguments = new TThreadedSelectorServer.Args(transport).processor(proc).protocolFactory(new TBinaryProtocol.Factory()).transportFactory(new TFramedTransport.Factory());
final TThreadedSelectorServer server = new TThreadedSelectorServer(arguments);
System.out.println("CA at port 8084");
server.serve();
}
use of org.apache.thrift.server.TThreadedSelectorServer in project lucida by claritylab.
the class QADaemon method main.
/**
* Entry point for question-answer.
* @param args the argument list. Provide port numbers
* for both sirius and qa.
*/
public static void main(String[] args) throws TTransportException, IOException, InterruptedException {
TProcessor proc = new LucidaService.AsyncProcessor(new QAServiceHandler.AsyncQAServiceHandler());
TNonblockingServerTransport transport = new TNonblockingServerSocket(8083);
TThreadedSelectorServer.Args arguments = new TThreadedSelectorServer.Args(transport).processor(proc).protocolFactory(new TBinaryProtocol.Factory()).transportFactory(new TFramedTransport.Factory());
final TThreadedSelectorServer server = new TThreadedSelectorServer(arguments);
System.out.println("QA at port 8083");
server.serve();
}
Aggregations