Thrift 阿帕奇节俭C++;异步客户端 我正在寻找一个C++异步客户端,并无阻塞C++服务器实现。我在apache中看到了一些邮件存档,但该活动在2009年晚些时候才开始。想知道最近的节俭是否支持它。我使用C++代码的COBYStRype选项,但是生成的代码不编译。 非常感谢您的帮助, 感谢

Thrift 阿帕奇节俭C++;异步客户端 我正在寻找一个C++异步客户端,并无阻塞C++服务器实现。我在apache中看到了一些邮件存档,但该活动在2009年晚些时候才开始。想知道最近的节俭是否支持它。我使用C++代码的COBYStRype选项,但是生成的代码不编译。 非常感谢您的帮助, 感谢,thrift,Thrift,对于服务器,您有C++中的TNonBlockingServer实现: using namespace ::apache::thrift; using namespace ::apache::thrift::protocol; using namespace ::apache::thrift::transport; using namespace ::apache::thrift::server; using namespace ::apache::thrift::concurrency; s

对于服务器,您有C++中的TNonBlockingServer实现:

using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
using namespace ::apache::thrift::concurrency;


shared_ptr<MyHandler> handler(new MyHandler());
shared_ptr<TProcessor> processor(new (handler));
shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());

// using thread pool with maximum 15 threads to handle incoming requests
shared_ptr<ThreadManager> threadManager = ThreadManager::newSimpleThreadManager(15);
shared_ptr<PosixThreadFactory> threadFactory = shared_ptr<PosixThreadFactory>(new PosixThreadFactory());
threadManager->threadFactory(threadFactory);
threadManager->start();

//create and start the server
shared_ptr<TNonblockingServer> server = new  TNonblockingServer(processor, protocolFactory, port, threadManager);
server->serve();
使用名称空间::apache::thrift;
使用namespace::apache::thrift::protocol;
使用namespace::apache::thrift::transport;
使用namespace::apache::thrift::server;
使用namespace::apache::thrift::concurrency;
共享的ptr处理程序(新的MyHandler());
共享ptr处理器(新的(处理器));
共享的ptr协议工厂(新的TBinaryProtocolFactory());
//使用最多15个线程的线程池来处理传入请求
shared_ptr threadManager=threadManager::newSimpleThreadManager(15);
shared_ptr threadFactory=shared_ptr(新的PosixThreadFactory());
threadManager->threadFactory(threadFactory);
threadManager->start();
//创建并启动服务器
shared_ptr server=新的TNonblockingServer(处理器、协议工厂、端口、线程管理器);
服务器->服务();