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
diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc
index fb1d7b0..e75573e 100755
--- a/compiler/cpp/src/generate/t_cpp_generator.cc
+++ b/compiler/cpp/src/generate/t_cpp_generator.cc
@@ -2926,7 +2926,9 @@
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 @@
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 @@
// 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 @@
" > 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 a0b5428..c62f8b7 100644
--- a/lib/cpp/src/async/TAsyncProcessor.h
+++ b/lib/cpp/src/async/TAsyncProcessor.h
@@ -70,6 +70,23 @@
}
};
+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