You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2011/09/25 09:16:18 UTC
svn commit: r1175308 - in /thrift/trunk:
compiler/cpp/src/generate/t_cpp_generator.cc
lib/cpp/src/async/TAsyncProcessor.h
Author: roger
Date: Sun Sep 25 07:16:17 2011
New Revision: 1175308
URL: http://svn.apache.org/viewvc?rev=1175308&view=rev
Log:
THRIFT-1359 --gen-cob cpp:cob_style does not compile anymore
Patch: Alexandre Parenteau
Modified:
thrift/trunk/compiler/cpp/src/generate/t_cpp_generator.cc
thrift/trunk/lib/cpp/src/async/TAsyncProcessor.h
Modified: thrift/trunk/compiler/cpp/src/generate/t_cpp_generator.cc
URL: http://svn.apache.org/viewvc/thrift/trunk/compiler/cpp/src/generate/t_cpp_generator.cc?rev=1175308&r1=1175307&r2=1175308&view=diff
==============================================================================
--- thrift/trunk/compiler/cpp/src/generate/t_cpp_generator.cc (original)
+++ thrift/trunk/compiler/cpp/src/generate/t_cpp_generator.cc Sun Sep 25 07:16:17 2011
@@ -2926,7 +2926,9 @@ void ProcessorGenerator::generate_factor
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_factor
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_factor
// 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_factor
" > 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;
Modified: thrift/trunk/lib/cpp/src/async/TAsyncProcessor.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/src/async/TAsyncProcessor.h?rev=1175308&r1=1175307&r2=1175308&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/src/async/TAsyncProcessor.h (original)
+++ thrift/trunk/lib/cpp/src/async/TAsyncProcessor.h Sun Sep 25 07:16:17 2011
@@ -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<TAsyncProcessor> getProcessor(
+ const TConnectionInfo& connInfo) = 0;
+};
+
+
+
}}} // apache::thrift::async
// XXX I'm lazy for now