Updated Branches:
  refs/heads/master 4f623260b -> 5ed5e8b3f

THRIFT-1917 Task expiration in TThreadPoolServer
Patch: Ivan Fastov


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/5ed5e8b3
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/5ed5e8b3
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/5ed5e8b3

Branch: refs/heads/master
Commit: 5ed5e8b3f0bff13cbc551ce82d9960b188bb8175
Parents: 4f62326
Author: Roger Meier <[email protected]>
Authored: Mon May 6 00:21:04 2013 +0200
Committer: Roger Meier <[email protected]>
Committed: Mon May 6 00:21:04 2013 +0200

----------------------------------------------------------------------
 lib/cpp/src/thrift/server/TThreadPoolServer.cpp |   10 +++++++++-
 lib/cpp/src/thrift/server/TThreadPoolServer.h   |   18 ++++++++++++++----
 2 files changed, 23 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/5ed5e8b3/lib/cpp/src/thrift/server/TThreadPoolServer.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/server/TThreadPoolServer.cpp 
b/lib/cpp/src/thrift/server/TThreadPoolServer.cpp
index d3b9714..ef1f522 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<TThreadPoolServer::Task> 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

http://git-wip-us.apache.org/repos/asf/thrift/blob/5ed5e8b3/lib/cpp/src/thrift/server/TThreadPoolServer.h
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/server/TThreadPoolServer.h 
b/lib/cpp/src/thrift/server/TThreadPoolServer.h
index 70b19bb..8a1fc16 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<typename Processor>
   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<typename ProcessorFactory>
   TThreadPoolServer(
@@ -79,7 +81,8 @@ class TThreadPoolServer : public TServer {
             inputProtocolFactory, outputProtocolFactory),
     threadManager_(threadManager),
     stop_(false),
-    timeout_(0) {}
+    timeout_(0),
+    taskExpiration_(0) {}
 
   template<typename Processor>
   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> threadManager_;
@@ -119,6 +127,8 @@ class TThreadPoolServer : public TServer {
 
   volatile int64_t timeout_;
 
+  volatile int64_t taskExpiration_;
+
 };
 
 }}} // apache::thrift::server

Reply via email to