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();
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;
// 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();
" > 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;
}
};
+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