-- Nonblocking server changes to allow logging
Summary:
-- the constructor needs to accept a transport factory
-- TConnection close() needs to close factor generated transports
Reviewed By: Mark Slee
Test Plan: Tested with search redologger
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664930 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/server/TServer.h b/lib/cpp/src/server/TServer.h
index 4b20432..b9f4fca 100644
--- a/lib/cpp/src/server/TServer.h
+++ b/lib/cpp/src/server/TServer.h
@@ -33,11 +33,20 @@
shared_ptr<TProcessor> getProcessor() {
return processor_;
}
+
+ shared_ptr<TServerTransport> getServerTransport() {
+ return serverTransport_;
+ }
+
+ shared_ptr<TTransportFactory> getTransportFactory() {
+ return transportFactory_;
+ }
shared_ptr<TProtocolFactory> getProtocolFactory() {
return protocolFactory_;
}
+
protected:
TServer(shared_ptr<TProcessor> processor,
shared_ptr<TServerTransport> serverTransport,
@@ -70,6 +79,27 @@
transportFactory_ = boost::shared_ptr<TTransportFactory>(new TTransportFactory());
protocolFactory_ = boost::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory());
}
+
+ TServer(shared_ptr<TProcessor> processor,
+ shared_ptr<TTransportFactory> transportFactory) :
+ processor_(processor),
+ transportFactory_(transportFactory) {
+ protocolFactory_ = boost::shared_ptr<TProtocolFactory>(new TBinaryProtocolFactory());
+ }
+
+ TServer(shared_ptr<TProcessor> processor,
+ shared_ptr<TProtocolFactory> protocolFactory) :
+ processor_(processor) {
+ transportFactory_ = boost::shared_ptr<TTransportFactory>(new TTransportFactory());
+ protocolFactory_ = protocolFactory;
+ }
+
+ TServer(shared_ptr<TProcessor> processor,
+ shared_ptr<TProtocolFactory> protocolFactory,
+ shared_ptr<TTransportFactory> transportFactory):
+ processor_(processor),
+ transportFactory_(transportFactory),
+ protocolFactory_(protocolFactory) {}
shared_ptr<TProcessor> processor_;
shared_ptr<TServerTransport> serverTransport_;