You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2013/02/08 18:28:20 UTC

svn commit: r1444161 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads: CompositeTaskRunner.cpp DedicatedTaskRunner.cpp

Author: tabish
Date: Fri Feb  8 17:28:20 2013
New Revision: 1444161

URL: http://svn.apache.org/r1444161
Log:
https://issues.apache.org/jira/browse/AMQCPP-457

Better control over Transport start and stop.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads/CompositeTaskRunner.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads/DedicatedTaskRunner.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads/CompositeTaskRunner.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads/CompositeTaskRunner.cpp?rev=1444161&r1=1444160&r2=1444161&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads/CompositeTaskRunner.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads/CompositeTaskRunner.cpp Fri Feb  8 17:28:20 2013
@@ -33,6 +33,8 @@ using namespace decaf::lang::exceptions;
 ////////////////////////////////////////////////////////////////////////////////
 CompositeTaskRunner::CompositeTaskRunner() :
     tasks(), mutex(), thread(), threadTerminated(false), pending(false), shutDown(false) {
+
+    this->thread.reset(new Thread(this, "ActiveMQ CompositeTaskRunner Thread"));
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -49,8 +51,7 @@ CompositeTaskRunner::~CompositeTaskRunne
 void CompositeTaskRunner::start() {
 
     synchronized(&mutex) {
-        if (this->thread == NULL) {
-            this->thread.reset(new Thread(this, "ActiveMQ CompositeTaskRunner Thread"));
+        if (!shutDown && !this->thread->isAlive()) {
             this->thread->start();
             this->wakeup();
         }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads/DedicatedTaskRunner.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads/DedicatedTaskRunner.cpp?rev=1444161&r1=1444160&r2=1444161&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads/DedicatedTaskRunner.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads/DedicatedTaskRunner.cpp Fri Feb  8 17:28:20 2013
@@ -34,6 +34,7 @@ DedicatedTaskRunner::DedicatedTaskRunner
         throw NullPointerException(__FILE__, __LINE__, "Task passed was null");
     }
 
+    this->thread.reset(new Thread(this, "ActiveMQ Dedicated Task Runner"));
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -48,8 +49,7 @@ DedicatedTaskRunner::~DedicatedTaskRunne
 void DedicatedTaskRunner::start() {
 
     synchronized(&mutex) {
-        if (this->thread == NULL) {
-            this->thread.reset(new Thread(this, "ActiveMQ Dedicated Task Runner"));
+        if (!shutDown && !this->thread->isAlive()) {
             this->thread->start();
             this->wakeup();
         }