当前位置: 首页>>代码示例>>Java>>正文


Java TBinaryProtocol类代码示例

本文整理汇总了Java中org.apache.thrift7.protocol.TBinaryProtocol的典型用法代码示例。如果您正苦于以下问题:Java TBinaryProtocol类的具体用法?Java TBinaryProtocol怎么用?Java TBinaryProtocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TBinaryProtocol类属于org.apache.thrift7.protocol包,在下文中一共展示了TBinaryProtocol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initHandlerServer

import org.apache.thrift7.protocol.TBinaryProtocol; //导入依赖的package包/类
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;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:24,代码来源:Drpc.java

示例2: initInvokeServer

import org.apache.thrift7.protocol.TBinaryProtocol; //导入依赖的package包/类
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;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:18,代码来源:Drpc.java

示例3: initThrift

import org.apache.thrift7.protocol.TBinaryProtocol; //导入依赖的package包/类
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();
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:23,代码来源:NimbusServer.java

示例4: getServer

import org.apache.thrift7.protocol.TBinaryProtocol; //导入依赖的package包/类
@Override
public TServer getServer(int port, TProcessor processor)
		throws IOException, TTransportException {
	TTransportFactory serverTransportFactory = getServerTransportFactory();

	// define THsHaServer args
	// original: THsHaServer + TNonblockingServerSocket
	// option: TThreadPoolServer + TServerSocket
	TServerSocket serverTransport = new TServerSocket(port);
	TThreadPoolServer.Args server_args = new TThreadPoolServer.Args(
			serverTransport).processor(new TUGIWrapProcessor(processor))
			.minWorkerThreads(64).maxWorkerThreads(64)
			.protocolFactory(new TBinaryProtocol.Factory());
	if (serverTransportFactory != null)
		server_args.transportFactory(serverTransportFactory);

	// construct THsHaServer
	return new TThreadPoolServer(server_args);
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:20,代码来源:SaslTransportPlugin.java

示例5: initThrift

import org.apache.thrift7.protocol.TBinaryProtocol; //导入依赖的package包/类
@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();
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:20,代码来源:NimbusServer.java

示例6: getServer

import org.apache.thrift7.protocol.TBinaryProtocol; //导入依赖的package包/类
public TServer getServer(int port, TProcessor processor)
		throws IOException, TTransportException {
	TTransportFactory serverTransportFactory = getServerTransportFactory();

	// define THsHaServer args
	// original: THsHaServer + TNonblockingServerSocket
	// option: TThreadPoolServer + TServerSocket
	TServerSocket serverTransport = new TServerSocket(port);
	TThreadPoolServer.Args server_args = new TThreadPoolServer.Args(
			serverTransport).processor(new TUGIWrapProcessor(processor))
			.minWorkerThreads(64).maxWorkerThreads(64)
			.protocolFactory(new TBinaryProtocol.Factory());
	if (serverTransportFactory != null)
		server_args.transportFactory(serverTransportFactory);

	// construct THsHaServer
	return new TThreadPoolServer(server_args);
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:19,代码来源:SaslTransportPlugin.java

示例7: initThrift

import org.apache.thrift7.protocol.TBinaryProtocol; //导入依赖的package包/类
@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();
}
 
开发者ID:greeenSY,项目名称:Tstream,代码行数:24,代码来源:NimbusServer.java

示例8: nimbusClientandConn

import org.apache.thrift7.protocol.TBinaryProtocol; //导入依赖的package包/类
public static List nimbusClientandConn(String host, Integer port)
		throws TTransportException {
	TSocket ts = new TSocket(host, port);
	TFramedTransport tt = new TFramedTransport(ts);
	TBinaryProtocol prot = new TBinaryProtocol(tt);
	Client nc = new Client(prot);
	ts.open();
	List l = new ArrayList();
	l.add(nc);
	l.add(tt);
	return l;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:13,代码来源:UIUtils.java

示例9: getServer

import org.apache.thrift7.protocol.TBinaryProtocol; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:17,代码来源:SimpleTransportPlugin.java

示例10: connect

import org.apache.thrift7.protocol.TBinaryProtocol; //导入依赖的package包/类
private void connect() throws TException {
	TSocket socket = new TSocket(host, port);
	if (timeout != null) {
		socket.setTimeout(timeout);
	}
	conn = new TFramedTransport(socket);
	client = new DistributedRPC.Client(new TBinaryProtocol(conn));
	conn.open();
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:10,代码来源:DRPCClient.java

示例11: getServer

import org.apache.thrift7.protocol.TBinaryProtocol; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:14,代码来源:SimpleTransportPlugin.java

示例12: getServer

import org.apache.thrift7.protocol.TBinaryProtocol; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:16,代码来源:SimpleTransportPlugin.java

示例13: ThriftConnection

import org.apache.thrift7.protocol.TBinaryProtocol; //导入依赖的package包/类
/**
 * Creates a connection with explicit nimbus host. Ignored if a local cluster is set 
 * for testing.
 * 
 * @param nimbusHost the nimbus host name
 * @param port the nimbus port number
 * @see #setLocalCluster(ILocalCluster)
 */
public ThriftConnection(String nimbusHost, int port) {
    if (null == localCluster) {
        socket = new TSocket(nimbusHost, port);
        LOGGER.info("Thrift connection info " + nimbusHost + " " + port);
        transport = new TFramedTransport(socket);
        protocol = new TBinaryProtocol(transport);
        client = new Client(protocol);
    }
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:18,代码来源:ThriftConnection.java

示例14: KestrelThriftClient

import org.apache.thrift7.protocol.TBinaryProtocol; //导入依赖的package包/类
public KestrelThriftClient(String hostname, int port)
		throws TException
{

	_transport = new TFramedTransport(new TSocket(hostname, port));
	final TProtocol proto = new TBinaryProtocol(_transport);
	_client = new Kestrel.Client(proto);
	_transport.open();
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:10,代码来源:KestrelThriftClient.java

示例15: connect

import org.apache.thrift7.protocol.TBinaryProtocol; //导入依赖的package包/类
private void connect() throws TException {
	conn = new TFramedTransport(new TSocket(host, port));
	client = new DistributedRPCInvocations.Client(new TBinaryProtocol(conn));
	conn.open();
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:6,代码来源:DRPCInvocationsClient.java


注:本文中的org.apache.thrift7.protocol.TBinaryProtocol类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。