Java 类org.apache.thrift7.transport.TNonblockingServerSocket 实例源码

项目:jstorm-0.9.6.3-    文件:Drpc.java   
private THsHaServer initHandlerServer(Map conf, final Drpc service)
        throws Exception {
    int port = JStormUtils.parseInt(conf.get(Config.DRPC_PORT));
    int workerThreadNum = JStormUtils.parseInt(conf.get(Config.DRPC_WORKER_THREADS));
    int queueSize = JStormUtils.parseInt(conf.get(Config.DRPC_QUEUE_SIZE));

    TNonblockingServerSocket socket = new TNonblockingServerSocket(port);
    THsHaServer.Args targs = new THsHaServer.Args(socket);
    targs.workerThreads(64);
    targs.protocolFactory(new TBinaryProtocol.Factory());
    targs.processor(new DistributedRPC.Processor<DistributedRPC.Iface>(
            service));

    ThreadPoolExecutor executor = new ThreadPoolExecutor(workerThreadNum, 
            workerThreadNum, 60, TimeUnit.SECONDS, 
            new ArrayBlockingQueue(queueSize));
    targs.executorService(executor);

    THsHaServer handlerServer = new THsHaServer(targs);
    LOG.info("Successfully init Handler Server " + port);

    return handlerServer;
}
项目:jstorm-0.9.6.3-    文件:Drpc.java   
private THsHaServer initInvokeServer(Map conf, final Drpc service)
        throws Exception {
    int port = JStormUtils.parseInt(conf.get(Config.DRPC_INVOCATIONS_PORT));

    TNonblockingServerSocket socket = new TNonblockingServerSocket(port);
    THsHaServer.Args targsInvoke = new THsHaServer.Args(socket);
    targsInvoke.workerThreads(64);
    targsInvoke.protocolFactory(new TBinaryProtocol.Factory());
    targsInvoke
            .processor(new DistributedRPCInvocations.Processor<DistributedRPCInvocations.Iface>(
                    service));

    THsHaServer invokeServer = new THsHaServer(targsInvoke);

    LOG.info("Successfully init Invoke Server " + port);
    return invokeServer;
}
项目:jstorm-0.9.6.3-    文件:NimbusServer.java   
private void initThrift(Map conf) throws TTransportException {
    Integer thrift_port = JStormUtils.parseInt(conf
            .get(Config.NIMBUS_THRIFT_PORT));
    TNonblockingServerSocket socket = new TNonblockingServerSocket(
            thrift_port);

    Integer maxReadBufSize = JStormUtils.parseInt(conf
            .get(Config.NIMBUS_THRIFT_MAX_BUFFER_SIZE));

    THsHaServer.Args args = new THsHaServer.Args(socket);
    args.workerThreads(ServiceHandler.THREAD_NUM);
    args.protocolFactory(new TBinaryProtocol.Factory(false, true,
            maxReadBufSize));

    args.processor(new Nimbus.Processor<Iface>(serviceHandler));
    args.maxReadBufferBytes = maxReadBufSize;

    thriftServer = new THsHaServer(args);

    LOG.info("Successfully started nimbus: started Thrift server...");
    thriftServer.serve();
}
项目:learn_jstorm    文件:Drpc.java   
private THsHaServer initHandlerServer(Map conf, final Drpc service)
        throws Exception {
    int port = JStormUtils.parseInt(conf.get(Config.DRPC_PORT));
    int workerThreadNum = JStormUtils.parseInt(conf.get(Config.DRPC_WORKER_THREADS));
    int queueSize = JStormUtils.parseInt(conf.get(Config.DRPC_QUEUE_SIZE));

    TNonblockingServerSocket socket = new TNonblockingServerSocket(port);
    THsHaServer.Args targs = new THsHaServer.Args(socket);
    targs.workerThreads(64);
    targs.protocolFactory(new TBinaryProtocol.Factory());
    targs.processor(new DistributedRPC.Processor<DistributedRPC.Iface>(
            service));

    ThreadPoolExecutor executor = new ThreadPoolExecutor(workerThreadNum, 
            workerThreadNum, 60, TimeUnit.SECONDS, 
            new ArrayBlockingQueue(queueSize));
    targs.executorService(executor);

    THsHaServer handlerServer = new THsHaServer(targs);
    LOG.info("Successfully init Handler Server " + port);

    return handlerServer;
}
项目:learn_jstorm    文件:Drpc.java   
private THsHaServer initInvokeServer(Map conf, final Drpc service)
        throws Exception {
    int port = JStormUtils.parseInt(conf.get(Config.DRPC_INVOCATIONS_PORT));

    TNonblockingServerSocket socket = new TNonblockingServerSocket(port);
    THsHaServer.Args targsInvoke = new THsHaServer.Args(socket);
    targsInvoke.workerThreads(64);
    targsInvoke.protocolFactory(new TBinaryProtocol.Factory());
    targsInvoke
            .processor(new DistributedRPCInvocations.Processor<DistributedRPCInvocations.Iface>(
                    service));

    THsHaServer invokeServer = new THsHaServer(targsInvoke);

    LOG.info("Successfully init Invoke Server " + port);
    return invokeServer;
}
项目:learn_jstorm    文件:NimbusServer.java   
@SuppressWarnings("rawtypes")
private void initThrift(Map conf) throws TTransportException {
    Integer thrift_port = JStormUtils.parseInt(conf.get(Config.NIMBUS_THRIFT_PORT));
    TNonblockingServerSocket socket = new TNonblockingServerSocket(thrift_port);

    Integer maxReadBufSize = JStormUtils.parseInt(conf.get(Config.NIMBUS_THRIFT_MAX_BUFFER_SIZE));

    THsHaServer.Args args = new THsHaServer.Args(socket);
    args.workerThreads(ServiceHandler.THREAD_NUM);
    args.protocolFactory(new TBinaryProtocol.Factory(false, true, maxReadBufSize));

    args.processor(new Nimbus.Processor<Iface>(serviceHandler));
    args.maxReadBufferBytes = maxReadBufSize;

    thriftServer = new THsHaServer(args);

    LOG.info("Successfully started nimbus: started Thrift server...");
    thriftServer.serve();
}
项目:Tstream    文件:Drpc.java   
private THsHaServer initHandlerServer(Map conf, final Drpc service)
        throws Exception {
    int port = JStormUtils.parseInt(conf.get(Config.DRPC_PORT));
    int workerThreadNum = JStormUtils.parseInt(conf.get(Config.DRPC_WORKER_THREADS));
    int queueSize = JStormUtils.parseInt(conf.get(Config.DRPC_QUEUE_SIZE));

    TNonblockingServerSocket socket = new TNonblockingServerSocket(port);
    THsHaServer.Args targs = new THsHaServer.Args(socket);
    targs.workerThreads(64);
    targs.protocolFactory(new TBinaryProtocol.Factory());
    targs.processor(new DistributedRPC.Processor<DistributedRPC.Iface>(
            service));

    ThreadPoolExecutor executor = new ThreadPoolExecutor(workerThreadNum, 
            workerThreadNum, 60, TimeUnit.SECONDS, 
            new ArrayBlockingQueue(queueSize));
    targs.executorService(executor);

    THsHaServer handlerServer = new THsHaServer(targs);
    LOG.info("Successfully init Handler Server " + port);

    return handlerServer;
}
项目:Tstream    文件:Drpc.java   
private THsHaServer initInvokeServer(Map conf, final Drpc service)
        throws Exception {
    int port = JStormUtils.parseInt(conf.get(Config.DRPC_INVOCATIONS_PORT));

    TNonblockingServerSocket socket = new TNonblockingServerSocket(port);
    THsHaServer.Args targsInvoke = new THsHaServer.Args(socket);
    targsInvoke.workerThreads(64);
    targsInvoke.protocolFactory(new TBinaryProtocol.Factory());
    targsInvoke
            .processor(new DistributedRPCInvocations.Processor<DistributedRPCInvocations.Iface>(
                    service));

    THsHaServer invokeServer = new THsHaServer(targsInvoke);

    LOG.info("Successfully init Invoke Server " + port);
    return invokeServer;
}
项目:Tstream    文件:NimbusServer.java   
@SuppressWarnings("rawtypes")
private void initThrift(Map conf) throws TTransportException {
    Integer thrift_port = JStormUtils.parseInt(conf
            .get(Config.NIMBUS_THRIFT_PORT));
    TNonblockingServerSocket socket = new TNonblockingServerSocket(
            thrift_port);

    Integer maxReadBufSize = JStormUtils.parseInt(conf
            .get(Config.NIMBUS_THRIFT_MAX_BUFFER_SIZE));

    THsHaServer.Args args = new THsHaServer.Args(socket);
    args.workerThreads(ServiceHandler.THREAD_NUM);
    args.protocolFactory(new TBinaryProtocol.Factory(false, true,
            maxReadBufSize));

    args.processor(new Nimbus.Processor<Iface>(serviceHandler));
    args.maxReadBufferBytes = maxReadBufSize;

    thriftServer = new THsHaServer(args);

    LOG.info("Successfully started nimbus: started Thrift server...");
    thriftServer.serve();
}
项目:jstorm-0.9.6.3-    文件:SimpleTransportPlugin.java   
/**
 * We will let Thrift to apply default transport factory
 */
@Override
public TServer getServer(int port, TProcessor processor)
        throws IOException, TTransportException {
    TNonblockingServerSocket serverTransport = new TNonblockingServerSocket(
            port);
    THsHaServer.Args server_args = new THsHaServer.Args(serverTransport)
            .processor(new SimpleWrapProcessor(processor))
            .workerThreads(64)
            .protocolFactory(new TBinaryProtocol.Factory());

    // construct THsHaServer
    return new THsHaServer(server_args);
}
项目:jstorm-0.9.6.3-    文件:SimpleTransportPlugin.java   
/**
 * We will let Thrift to apply default transport factory
 */
public TServer getServer(int port, TProcessor processor) throws IOException, TTransportException {
    TNonblockingServerSocket serverTransport = new TNonblockingServerSocket(port);
    THsHaServer.Args server_args = new THsHaServer.Args(serverTransport).
            processor(new SimpleWrapProcessor(processor)).
            workerThreads(64).
            protocolFactory(new TBinaryProtocol.Factory());            

    //construct THsHaServer
    return new THsHaServer(server_args);
}
项目:learn_jstorm    文件:SimpleTransportPlugin.java   
/**
 * We will let Thrift to apply default transport factory
 */
public TServer getServer(int port, TProcessor processor)
        throws IOException, TTransportException {
    TNonblockingServerSocket serverTransport = new TNonblockingServerSocket(
            port);
    THsHaServer.Args server_args = new THsHaServer.Args(serverTransport)
            .processor(new SimpleWrapProcessor(processor))
            .workerThreads(64)
            .protocolFactory(new TBinaryProtocol.Factory());

    // construct THsHaServer
    return new THsHaServer(server_args);
}
项目:learn_jstorm    文件:SimpleTransportPlugin.java   
/**
 * We will let Thrift to apply default transport factory
 */
public TServer getServer(int port, TProcessor processor) throws IOException, TTransportException {
    TNonblockingServerSocket serverTransport = new TNonblockingServerSocket(port);
    THsHaServer.Args server_args = new THsHaServer.Args(serverTransport).
            processor(new SimpleWrapProcessor(processor)).
            workerThreads(64).
            protocolFactory(new TBinaryProtocol.Factory());            

    //construct THsHaServer
    return new THsHaServer(server_args);
}
项目:jstrom    文件:SimpleTransportPlugin.java   
/**
 * We will let Thrift to apply default transport factory
 */
public TServer getServer(int port, TProcessor processor) throws IOException, TTransportException {
    TNonblockingServerSocket serverTransport = new TNonblockingServerSocket(port);
    THsHaServer.Args server_args = new THsHaServer.Args(serverTransport).
            processor(new SimpleWrapProcessor(processor)).
            workerThreads(64).
            protocolFactory(new TBinaryProtocol.Factory());            

    //construct THsHaServer
    return new THsHaServer(server_args);
}
项目:Tstream    文件:SimpleTransportPlugin.java   
/**
 * We will let Thrift to apply default transport factory
 */
public TServer getServer(int port, TProcessor processor)
        throws IOException, TTransportException {
    TNonblockingServerSocket serverTransport = new TNonblockingServerSocket(
            port);
    THsHaServer.Args server_args = new THsHaServer.Args(serverTransport)
            .processor(new SimpleWrapProcessor(processor))
            .workerThreads(64)
            .protocolFactory(new TBinaryProtocol.Factory());

    // construct THsHaServer
    return new THsHaServer(server_args);
}