本文整理匯總了Java中org.apache.thrift.server.TNonblockingServer.Args方法的典型用法代碼示例。如果您正苦於以下問題:Java TNonblockingServer.Args方法的具體用法?Java TNonblockingServer.Args怎麽用?Java TNonblockingServer.Args使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.thrift.server.TNonblockingServer
的用法示例。
在下文中一共展示了TNonblockingServer.Args方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createThrift
import org.apache.thrift.server.TNonblockingServer; //導入方法依賴的package包/類
private static boolean createThrift() {
String flag = getClassName() + ".createThrift";
try {
TProcessor tProcessor = new FrcService.Processor<FrcService.Iface>(theInstance);
TNonblockingServerSocket tnbSocketTransport = new TNonblockingServerSocket(thrift_port);
TNonblockingServer.Args tnbArgs = new TNonblockingServer.Args(tnbSocketTransport);
tnbArgs.maxReadBufferBytes = DefaultValues.THRIFT_MAX_READ_BUF;
tnbArgs.processor(tProcessor);
// tnbArgs.transportFactory(new LCQTFramedTransport.Factory());
tnbArgs.transportFactory(new TFramedTransport.Factory());
tnbArgs.protocolFactory(new TBinaryProtocol.Factory());
server = new TNonblockingServer(tnbArgs);
// server.setServerEventHandler(new LCQTServerEventHandler());
return true;
} catch (Exception e) {
FRCLogger.getInstance().warn(-100, flag, "exception", e);
return false;
}
}
示例2: buildTServer
import org.apache.thrift.server.TNonblockingServer; //導入方法依賴的package包/類
public TServer buildTServer(Args args)
{
if (DatabaseDescriptor.getClientEncryptionOptions().enabled)
throw new RuntimeException("Client SSL is not supported for non-blocking sockets. Please remove client ssl from the configuration.");
final InetSocketAddress addr = args.addr;
TNonblockingServerTransport serverTransport;
try
{
serverTransport = new TCustomNonblockingServerSocket(addr, args.keepAlive, args.sendBufferSize, args.recvBufferSize);
}
catch (TTransportException e)
{
throw new RuntimeException(String.format("Unable to create thrift socket to %s:%s", addr.getAddress(), addr.getPort()), e);
}
// This is single threaded hence the invocation will be all
// in one thread.
TNonblockingServer.Args serverArgs = new TNonblockingServer.Args(serverTransport).inputTransportFactory(args.inTransportFactory)
.outputTransportFactory(args.outTransportFactory)
.inputProtocolFactory(args.tProtocolFactory)
.outputProtocolFactory(args.tProtocolFactory)
.processor(args.processor);
return new CustomTNonBlockingServer(serverArgs);
}
示例3: buildTServer
import org.apache.thrift.server.TNonblockingServer; //導入方法依賴的package包/類
@SuppressWarnings("resource")
public TServer buildTServer(Args args)
{
if (DatabaseDescriptor.getClientEncryptionOptions().enabled)
throw new RuntimeException("Client SSL is not supported for non-blocking sockets. Please remove client ssl from the configuration.");
final InetSocketAddress addr = args.addr;
TNonblockingServerTransport serverTransport;
try
{
serverTransport = new TCustomNonblockingServerSocket(addr, args.keepAlive, args.sendBufferSize, args.recvBufferSize);
}
catch (TTransportException e)
{
throw new RuntimeException(String.format("Unable to create thrift socket to %s:%s", addr.getAddress(), addr.getPort()), e);
}
// This is single threaded hence the invocation will be all
// in one thread.
TNonblockingServer.Args serverArgs = new TNonblockingServer.Args(serverTransport).inputTransportFactory(args.inTransportFactory)
.outputTransportFactory(args.outTransportFactory)
.inputProtocolFactory(args.tProtocolFactory)
.outputProtocolFactory(args.tProtocolFactory)
.processor(args.processor);
return new CustomTNonBlockingServer(serverArgs);
}
示例4: ConcreteServer
import org.apache.thrift.server.TNonblockingServer; //導入方法依賴的package包/類
/**
*
*/
public ConcreteServer(AnnotateCommunicationService.Iface impl, int port) throws ServerException {
try {
this.serverXport = new TNonblockingServerSocket(port);
// TODO: eval HaHs server?
final TNonblockingServer.Args args = new TNonblockingServer.Args(this.serverXport);
args.protocolFactory(new TCompactProtocol.Factory());
// TODO: eval FastFramedTransport?
final TFramedTransport.Factory transFactory = new TFramedTransport.Factory(Integer.MAX_VALUE);
args.transportFactory(transFactory);
// legitimately do not know type bound here - guessing Iface
AnnotateCommunicationService.Processor<Iface> proc = new AnnotateCommunicationService.Processor<>(impl);
args.processorFactory(new TProcessorFactory(proc));
args.maxReadBufferBytes = Long.MAX_VALUE;
this.args = args;
// final TNonblockingServer server = new TNonblockingServer(args);
this.server = new TNonblockingServer(this.args);
} catch (TTransportException e) {
throw new ServerException(e);
}
}
示例5: run
import org.apache.thrift.server.TNonblockingServer; //導入方法依賴的package包/類
public void run() {
setName("Thrift Service");
try {
TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(port);
AsyncRainServiceImpl service = new AsyncRainServiceImpl(scenario);
RainService.Processor<RainService.Iface> processor = new RainService.Processor<RainService.Iface>(
service);
TNonblockingServer.Args args = new TNonblockingServer.Args(serverTransport);
args.processor(processor);
// Server (connects transport and processor)
server = new TNonblockingServer(args);
server.serve();
} catch (TTransportException e) {
e.printStackTrace();
}
}
示例6: ThriftServer
import org.apache.thrift.server.TNonblockingServer; //導入方法依賴的package包/類
public ThriftServer(QueueService.Iface queueService, ServerConfig serverConfig, ThriftServerStats stats) throws TTransportException {
this.queueService = queueService;
this.serverConfig = serverConfig;
this.stats = stats;
// assemble thrift server
TProcessor tprocessor = new QueueService.Processor(this.queueService);
TNonblockingServerSocket tnbSocketTransport = new TNonblockingServerSocket(serverConfig.getPort());
TNonblockingServer.Args tnbArgs = new TNonblockingServer.Args(tnbSocketTransport);
tnbArgs.processor(tprocessor);
// Nonblocking server mode must use TFramedTransport
tnbArgs.transportFactory(new TFramedTransport.Factory());
tnbArgs.protocolFactory(new TBinaryProtocol.Factory());
this.server = new TNonblockingServer(tnbArgs);
// THsHaServer.Args thhArgs = new THsHaServer.Args(tnbSocketTransport);
// thhArgs.processor(tprocessor);
// // Nonblocking server mode must use TFramedTransport
// thhArgs.transportFactory(new TFramedTransport.Factory());
// thhArgs.protocolFactory(new TBinaryProtocol.Factory());
//
// this.server = new THsHaServer(thhArgs);
this.serverThread = new ServerThread(this.server);
}
示例7: getTNonBlockingServer
import org.apache.thrift.server.TNonblockingServer; //導入方法依賴的package包/類
private static TServer getTNonBlockingServer(TProtocolFactory protocolFactory, TProcessor processor,
TTransportFactory transportFactory, InetSocketAddress inetSocketAddress) throws TTransportException {
TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(inetSocketAddress);
log.info("starting HBase Nonblocking Thrift server on " + inetSocketAddress.toString());
TNonblockingServer.Args serverArgs = new TNonblockingServer.Args(serverTransport);
serverArgs.processor(processor);
serverArgs.transportFactory(transportFactory);
serverArgs.protocolFactory(protocolFactory);
return new TNonblockingServer(serverArgs);
}
示例8: startNonblockingServer
import org.apache.thrift.server.TNonblockingServer; //導入方法依賴的package包/類
private TServer startNonblockingServer(TProcessor processor, TProtocolFactory protocolFactory) {
TNonblockingServerTransport nonblockingTransport = (TNonblockingServerTransport) serverTransport;
TNonblockingServer.Args args = new TNonblockingServer.Args(nonblockingTransport)
.processor(processor)
.protocolFactory(protocolFactory);
return new TNonblockingServer(args);
}
示例9: getTNonBlockingServer
import org.apache.thrift.server.TNonblockingServer; //導入方法依賴的package包/類
private static TServer getTNonBlockingServer(TProtocolFactory protocolFactory, THBaseService.Processor processor,
TTransportFactory transportFactory, InetSocketAddress inetSocketAddress) throws TTransportException {
TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(inetSocketAddress);
log.info("starting HBase Nonblocking Thrift server on " + inetSocketAddress.toString());
TNonblockingServer.Args serverArgs = new TNonblockingServer.Args(serverTransport);
serverArgs.processor(processor);
serverArgs.transportFactory(transportFactory);
serverArgs.protocolFactory(protocolFactory);
return new TNonblockingServer(serverArgs);
}
示例10: onFMLServerStartedEvent
import org.apache.thrift.server.TNonblockingServer; //導入方法依賴的package包/類
@EventHandler
public void onFMLServerStartedEvent(FMLServerStartedEvent e) {
log.info("Starting BlockTransfer server on port 9090");
IsoBlockProjectorServiceHandler handler = new IsoBlockProjectorServiceHandler();
Processor processor = new IsoBlockProjectorService.Processor(handler);
try {
TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(
9090);
TNonblockingServer.Args serverArgs = new TNonblockingServer.Args(serverTransport);
serverArgs.processor(processor);
serverArgs.transportFactory(new TFramedTransport.Factory());
serverArgs.protocolFactory(new TBinaryProtocol.Factory(true, true));
IBPserver = new TIsoBlockProjectorServer(serverArgs);
IBPserverthread = new Thread() {
public void run() {
IBPserver.serve();
}
};
IBPserverthread.start();
} catch (Exception ex) {
throw new RuntimeException("Unable to start BlockTransfer server",ex);
}
MinecraftForge.EVENT_BUS.register(this);
FMLCommonHandler.instance().bus().register(this);
}
示例11: getTNonBlockingServer
import org.apache.thrift.server.TNonblockingServer; //導入方法依賴的package包/類
private static TServer getTNonBlockingServer(TProtocolFactory protocolFactory,
TProcessor processor, TTransportFactory transportFactory, InetSocketAddress inetSocketAddress)
throws TTransportException {
TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(inetSocketAddress);
log.info("starting HBase Nonblocking Thrift server on " + inetSocketAddress.toString());
TNonblockingServer.Args serverArgs = new TNonblockingServer.Args(serverTransport);
serverArgs.processor(processor);
serverArgs.transportFactory(transportFactory);
serverArgs.protocolFactory(protocolFactory);
return new TNonblockingServer(serverArgs);
}
示例12: createNonBlockingServer
import org.apache.thrift.server.TNonblockingServer; //導入方法依賴的package包/類
public static TServer createNonBlockingServer(TProcessorFactory processorFactory, int port,
int clientTimeoutMillisecs, int maxFrameSize, long maxReadBufferSize)
throws TTransportException {
TNonblockingServerTransport transport = new TNonblockingServerSocket(port,
clientTimeoutMillisecs);
TProtocolFactory protocolFactory = new TBinaryProtocol.Factory();
TTransportFactory transportFactory = new TFramedTransport.Factory(maxFrameSize);
TNonblockingServer.Args args = new TNonblockingServer.Args(transport)
.processorFactory(processorFactory).protocolFactory(protocolFactory)
.transportFactory(transportFactory);
args.maxReadBufferBytes = maxReadBufferSize;
TNonblockingServer server = new TNonblockingServer(args);
return server;
}
示例13: main
import org.apache.thrift.server.TNonblockingServer; //導入方法依賴的package包/類
public static void main(String [] args)
throws TTransportException, IOException, InterruptedException {
connectToCMD();
TProcessor proc = new LucidaService.AsyncProcessor(
new QAServiceHandler.AsyncQAServiceHandler());
TNonblockingServerTransport transport = new TNonblockingServerSocket(8083);
TNonblockingServer.Args arguments = new TNonblockingServer.Args(transport)
.processor(proc)
.protocolFactory(new TBinaryProtocol.Factory())
.transportFactory(new TFramedTransport.Factory());
final TNonblockingServer server = new TNonblockingServer(arguments);
System.out.println("QA at port 8083");
server.serve();
}
示例14: buildTServer
import org.apache.thrift.server.TNonblockingServer; //導入方法依賴的package包/類
public TServer buildTServer(Args args)
{
if (DatabaseDescriptor.getClientEncryptionOptions().enabled)
throw new RuntimeException("Client SSL is not supported for non-blocking sockets (hsha). Please remove client ssl from the configuration.");
final InetSocketAddress addr = args.addr;
TNonblockingServerTransport serverTransport;
try
{
serverTransport = new TCustomNonblockingServerSocket(addr, args.keepAlive, args.sendBufferSize, args.recvBufferSize);
}
catch (TTransportException e)
{
throw new RuntimeException(String.format("Unable to create thrift socket to %s:%s", addr.getAddress(), addr.getPort()), e);
}
// This is NIO selector service but the invocation will be Multi-Threaded with the Executor service.
ExecutorService executorService = new JMXEnabledThreadPoolExecutor(DatabaseDescriptor.getRpcMinThreads(),
DatabaseDescriptor.getRpcMaxThreads(),
60L,
TimeUnit.SECONDS,
new SynchronousQueue<Runnable>(),
new NamedThreadFactory("RPC-Thread"), "RPC-THREAD-POOL");
TNonblockingServer.Args serverArgs = new TNonblockingServer.Args(serverTransport).inputTransportFactory(args.inTransportFactory)
.outputTransportFactory(args.outTransportFactory)
.inputProtocolFactory(args.tProtocolFactory)
.outputProtocolFactory(args.tProtocolFactory)
.processor(args.processor);
// Check for available processors in the system which will be equal to the IO Threads.
return new CustomTHsHaServer(serverArgs, executorService, FBUtilities.getAvailableProcessors());
}
示例15: ConcreteZipArchiveFetchServiceThread
import org.apache.thrift.server.TNonblockingServer; //導入方法依賴的package包/類
public ConcreteZipArchiveFetchServiceThread(FetchCommunicationService.Iface impl, int port) throws TException {
serverTransport = new TNonblockingServerSocket(port);
serverArgs = new TNonblockingServer.Args(serverTransport);
serverArgs.protocolFactory(new TCompactProtocol.Factory());
serverArgs.transportFactory(new TFramedTransport.Factory(Integer.MAX_VALUE));
serverArgs.processorFactory(new TProcessorFactory(new FetchCommunicationService.Processor<>(impl)));
serverArgs.maxReadBufferBytes = Long.MAX_VALUE;
server = new TNonblockingServer(serverArgs);
}