當前位置: 首頁>>代碼示例>>Java>>正文


Java TNonblockingServer.Args方法代碼示例

本文整理匯總了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;
    }
}
 
開發者ID:songbin,項目名稱:frc,代碼行數:22,代碼來源:Application.java

示例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);
}
 
開發者ID:vcostet,項目名稱:cassandra-kmean,代碼行數:26,代碼來源:CustomTNonBlockingServer.java

示例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);
}
 
開發者ID:scylladb,項目名稱:scylla-tools-java,代碼行數:27,代碼來源:CustomTNonBlockingServer.java

示例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);
  }
}
 
開發者ID:hltcoe,項目名稱:concrete-java,代碼行數:25,代碼來源:ConcreteServer.java

示例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();
	}
}
 
開發者ID:jacksonicson,項目名稱:rain,代碼行數:21,代碼來源:ThriftService.java

示例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);
	}
 
開發者ID:bulldog2011,項目名稱:luxun,代碼行數:27,代碼來源:ThriftServer.java

示例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);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:11,代碼來源:ThriftServer.java

示例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);
}
 
開發者ID:Microsoft,項目名稱:thrifty,代碼行數:9,代碼來源:TestServer.java

示例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);
}
 
開發者ID:fengchen8086,項目名稱:LCIndex-HBase-0.94.16,代碼行數:11,代碼來源:ThriftServer.java

示例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);
  }
 
開發者ID:gentili,項目名稱:IsoBlockProjector,代碼行數:28,代碼來源:IsoBlockProjector.java

示例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);
}
 
開發者ID:apache,項目名稱:hbase,代碼行數:12,代碼來源:ThriftServer.java

示例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;
}
 
開發者ID:DDTH,項目名稱:osgi-bundle-frontapi,代碼行數:15,代碼來源:ThriftUtils.java

示例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();
}
 
開發者ID:claritylab,項目名稱:lucida,代碼行數:16,代碼來源:QADaemon.java

示例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());
}
 
開發者ID:jackliu8722,項目名稱:cassandra-1.2.16,代碼行數:32,代碼來源:CustomTHsHaServer.java

示例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);
}
 
開發者ID:hltcoe,項目名稱:concrete-java,代碼行數:10,代碼來源:ConcreteZipArchiveFetchServiceThread.java


注:本文中的org.apache.thrift.server.TNonblockingServer.Args方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。