2012-04-27 22 views
2

私はC++非同期クライアントと非ブロックC++サーバーの実装を探しています。私は、いくつかのメールアーカイブをApacheで見ていますが、活動は2009年後半です。最新の倹約でサポートされているかどうかを知りたいですか?私はC++コードにcob_styleオプションを使用していますが、生成されたコードはコンパイルされません。 は、サーバーの おかげapache thrift C++非同期クライアント

答えて

3

を任意の助けをいただければ幸いです、あなたは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(); 
関連する問題