Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
From a01b4ee026a6e0fa269af9f3f16684c4e312cd3c Mon Sep 17 00:00:00 2001
From: Adam Simpkins <simpkins@fb.com>
Date: Mon, 19 Apr 2010 19:09:16 +0000
Subject: [PATCH 25/33] thrift: add TProcessorFactory
Summary:
Adds a new TProcessorFactory class, and update all server classes to
store a TProcessorFactory instead of a TProcessor.
TProcessorFactory::getProcessor() is called once for each newly accepted
connection. This will allow a separate processor to be created for each
connection, if desired.
For now, everything always uses TSingletonProcessorFactory, so all
connections still end up using the same TProcessor.
Some of the servers don't handle it well if getProcessor() throws an
exception. TNonblockingServer may leak the fd and a TConnection object.
TSimpleServer will exit and stop serving. However, this is no worse
than the existing behavior if eventHandler_->createContext() throws an
exception.
Test Plan:
Ran the test code from [a fb unittest].
Revert Plan:
OK
Conflicts:
lib/cpp/src/server/TSimpleServer.cpp
—
lib/cpp/src/TProcessor.h | 39 +++++++++++++++++++++++++++++
lib/cpp/src/server/TNonblockingServer.cpp | 12 ++++++--
lib/cpp/src/server/TServer.h | 31 +++++++++++++++++-----
lib/cpp/src/server/TSimpleServer.cpp | 9 +++++-
lib/cpp/src/server/TThreadPoolServer.cpp | 7 ++++-
lib/cpp/src/server/TThreadedServer.cpp | 5 +++-
6 files changed, 89 insertions, 14 deletions