thrift: update server classes to accept -----------------------------------------
Key: THRIFT-1316 URL: https://issues.apache.org/jira/browse/THRIFT-1316 Project: Thrift Issue Type: Improvement Components: C++ - Library Reporter: Dave Watson Priority: Minor Attachments: 0027-thrift-update-server-classes-to-accept-TProcessorFac.patch >From d645a23c026536598f7a922d2ebaeb599f4dcfdc Mon Sep 17 00:00:00 2001 From: Adam Simpkins <simpk...@fb.com> Date: Mon, 19 Apr 2010 19:09:25 +0000 Subject: [PATCH 27/33] thrift: update server classes to accept TProcessorFactory objects Summary: Update TSimpleServer, TThreadedServer, TThreadPoolServer, and TNonblockingServer constructors to accept either a TProcessorFactory or a TProcessor. Unfortunately, using boost::shared_ptr makes this somewhat more annoying, since shared_ptr's are no help for overload resolution: each shared_ptr type defines a template constructor that accepts any other arbitrary pointer type. (The constructor is defined, it is just an error to actually try an instantiate it with an inconvertible pointer type. However, because it is defined, it is still treated as valid for overload resolution.) Therefore we define a THRIFT_OVERLOAD_IF helper macro to force overload resolution to occur properly. Test Plan: Ran the test code from [fb unittest], although that only tests singleton factories. I also have an example program that demonstrates using real processor factories. I'll check that in separately. Revert Plan: OK Conflicts: lib/cpp/src/Thrift.h --- lib/cpp/src/Thrift.h | 25 ++++++++ lib/cpp/src/server/TNonblockingServer.h | 66 +++++++++++++++++++-- lib/cpp/src/server/TServer.h | 92 +++++++++++++++++++++++++---- lib/cpp/src/server/TSimpleServer.h | 51 +++++++++++++--- lib/cpp/src/server/TThreadPoolServer.cpp | 22 ------- lib/cpp/src/server/TThreadPoolServer.h | 73 +++++++++++++++++++---- lib/cpp/src/server/TThreadedServer.cpp | 22 ++------ lib/cpp/src/server/TThreadedServer.h | 91 ++++++++++++++++++++++++++--- 8 files changed, 351 insertions(+), 91 deletions(-) -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira