From db3c9249c831ac44b95673b2d91c3f3056766769 Mon Sep 17 00:00:00 2001 From: Roger Meier Date: Sun, 25 Sep 2011 07:16:17 +0000 Subject: [PATCH] THRIFT-1359 --gen-cob cpp:cob_style does not compile anymore Patch: Alexandre Parenteau git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1175308 13f79535-47bb-0310-9956-ffa450edef68 --- compiler/cpp/src/generate/t_cpp_generator.cc | 13 +++++++++---- lib/cpp/src/async/TAsyncProcessor.h | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc index fb1d7b00..e75573e0 100755 --- a/compiler/cpp/src/generate/t_cpp_generator.cc +++ b/compiler/cpp/src/generate/t_cpp_generator.cc @@ -2926,7 +2926,9 @@ void ProcessorGenerator::generate_factory() { f_header_ << template_header_ << "class " << factory_class_name_ << - " : public ::apache::thrift::TProcessorFactory {" << endl << + " : public ::apache::thrift::" << + (style_ == "Cob" ? "async::TAsyncProcessorFactory" : "TProcessorFactory") << + " {" << endl << " public:" << endl; indent_up(); @@ -2935,7 +2937,8 @@ void ProcessorGenerator::generate_factory() { if_factory_name << " >& handlerFactory) :" << endl << indent() << " handlerFactory_(handlerFactory) {}" << endl << endl << - indent() << "::boost::shared_ptr< ::apache::thrift::TProcessor > " << + indent() << "::boost::shared_ptr< ::apache::thrift::" << + (style_ == "Cob" ? "async::TAsyncProcessor" : "TProcessor") << " > " << "getProcessor(const ::apache::thrift::TConnectionInfo& connInfo);" << endl; @@ -2961,7 +2964,8 @@ void ProcessorGenerator::generate_factory() { // Generate the getProcessor() method f_out_ << template_header_ << - indent() << "::boost::shared_ptr< ::apache::thrift::TProcessor > " << + indent() << "::boost::shared_ptr< ::apache::thrift::" << + (style_ == "Cob" ? "async::TAsyncProcessor" : "TProcessor") << " > " << factory_class_name_ << template_suffix_ << "::getProcessor(" << "const ::apache::thrift::TConnectionInfo& connInfo) {" << endl; indent_up(); @@ -2971,7 +2975,8 @@ void ProcessorGenerator::generate_factory() { " > cleanup(handlerFactory_);" << endl << indent() << "::boost::shared_ptr< " << if_name_ << " > handler(" << "handlerFactory_->getHandler(connInfo), cleanup);" << endl << - indent() << "::boost::shared_ptr< ::apache::thrift::TProcessor > " << + indent() << "::boost::shared_ptr< ::apache::thrift::" << + (style_ == "Cob" ? "async::TAsyncProcessor" : "TProcessor") << " > " << "processor(new " << class_name_ << template_suffix_ << "(handler));" << endl << indent() << "return processor;" << endl; diff --git a/lib/cpp/src/async/TAsyncProcessor.h b/lib/cpp/src/async/TAsyncProcessor.h index a0b54281..c62f8b7a 100644 --- a/lib/cpp/src/async/TAsyncProcessor.h +++ b/lib/cpp/src/async/TAsyncProcessor.h @@ -70,6 +70,23 @@ class TAsyncProcessor { } }; +class TAsyncProcessorFactory { + public: + virtual ~TAsyncProcessorFactory() {} + + /** + * Get the TAsyncProcessor to use for a particular connection. + * + * This method is always invoked in the same thread that the connection was + * accepted on. This generally means that this call does not need to be + * thread safe, as it will always be invoked from a single thread. + */ + virtual boost::shared_ptr getProcessor( + const TConnectionInfo& connInfo) = 0; +}; + + + }}} // apache::thrift::async // XXX I'm lazy for now -- 2.17.1