From: Roger Meier Date: Sun, 5 May 2013 22:21:04 +0000 (+0200) Subject: THRIFT-1917 Task expiration in TThreadPoolServer X-Git-Tag: 0.9.1~124 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=5ed5e8b3f0bff13cbc551ce82d9960b188bb8175;p=common%2Fthrift.git THRIFT-1917 Task expiration in TThreadPoolServer Patch: Ivan Fastov --- diff --git a/lib/cpp/src/thrift/server/TThreadPoolServer.cpp b/lib/cpp/src/thrift/server/TThreadPoolServer.cpp index d3b97142..ef1f5227 100644 --- a/lib/cpp/src/thrift/server/TThreadPoolServer.cpp +++ b/lib/cpp/src/thrift/server/TThreadPoolServer.cpp @@ -152,7 +152,7 @@ void TThreadPoolServer::serve() { // Add to threadmanager pool shared_ptr task(new TThreadPoolServer::Task( *this, processor, inputProtocol, outputProtocol, client)); - threadManager_->add(task, timeout_); + threadManager_->add(task, timeout_, taskExpiration_); } catch (TTransportException& ttx) { if (inputTransport != NULL) { inputTransport->close(); } @@ -202,4 +202,12 @@ void TThreadPoolServer::setTimeout(int64_t value) { timeout_ = value; } +int64_t TThreadPoolServer::getTaskExpiration() const { + return taskExpiration_; +} + +void TThreadPoolServer::setTaskExpiration(int64_t value) { + taskExpiration_ = value; +} + }}} // apache::thrift::server diff --git a/lib/cpp/src/thrift/server/TThreadPoolServer.h b/lib/cpp/src/thrift/server/TThreadPoolServer.h index 70b19bbc..8a1fc163 100644 --- a/lib/cpp/src/thrift/server/TThreadPoolServer.h +++ b/lib/cpp/src/thrift/server/TThreadPoolServer.h @@ -49,7 +49,8 @@ class TThreadPoolServer : public TServer { protocolFactory), threadManager_(threadManager), stop_(false), - timeout_(0) {} + timeout_(0), + taskExpiration_(0) {} template TThreadPoolServer( @@ -62,7 +63,8 @@ class TThreadPoolServer : public TServer { TServer(processor, serverTransport, transportFactory, protocolFactory), threadManager_(threadManager), stop_(false), - timeout_(0) {} + timeout_(0), + taskExpiration_(0) {} template TThreadPoolServer( @@ -79,7 +81,8 @@ class TThreadPoolServer : public TServer { inputProtocolFactory, outputProtocolFactory), threadManager_(threadManager), stop_(false), - timeout_(0) {} + timeout_(0), + taskExpiration_(0) {} template TThreadPoolServer( @@ -96,7 +99,8 @@ class TThreadPoolServer : public TServer { inputProtocolFactory, outputProtocolFactory), threadManager_(threadManager), stop_(false), - timeout_(0) {} + timeout_(0), + taskExpiration_(0) {} virtual ~TThreadPoolServer(); @@ -111,6 +115,10 @@ class TThreadPoolServer : public TServer { serverTransport_->interrupt(); } + virtual int64_t getTaskExpiration() const; + + virtual void setTaskExpiration(int64_t value); + protected: boost::shared_ptr threadManager_; @@ -119,6 +127,8 @@ class TThreadPoolServer : public TServer { volatile int64_t timeout_; + volatile int64_t taskExpiration_; + }; }}} // apache::thrift::server