activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1444099 - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/activemq/core/ main/activemq/threads/ main/activemq/transport/inactivity/ test/activemq/threads/
Date Fri, 08 Feb 2013 16:27:24 GMT
Author: tabish
Date: Fri Feb  8 16:27:24 2013
New Revision: 1444099

URL: http://svn.apache.org/r1444099
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/core/ActiveMQSessionExecutor.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads/CompositeTaskRunner.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads/DedicatedTaskRunner.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/threads/CompositeTaskRunnerTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/threads/DedicatedTaskRunnerTest.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp?rev=1444099&r1=1444098&r2=1444099&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp
Fri Feb  8 16:27:24 2013
@@ -87,6 +87,7 @@ void ActiveMQSessionExecutor::wakeup() {
     synchronized(messageQueue.get()) {
         if (this->taskRunner == NULL) {
             this->taskRunner.reset(new DedicatedTaskRunner(this));
+            this->taskRunner->start();
         }
 
         taskRunner = this->taskRunner;

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=1444099&r1=1444098&r2=1444099&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 16:27:24 2013
@@ -52,6 +52,7 @@ void CompositeTaskRunner::start() {
         if (this->thread == NULL) {
             this->thread.reset(new Thread(this, "ActiveMQ CompositeTaskRunner Thread"));
             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=1444099&r1=1444098&r2=1444099&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 16:27:24 2013
@@ -51,6 +51,7 @@ void DedicatedTaskRunner::start() {
         if (this->thread == NULL) {
             this->thread.reset(new Thread(this, "ActiveMQ Dedicated Task Runner"));
             this->thread->start();
+            this->wakeup();
         }
     }
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.cpp?rev=1444099&r1=1444098&r2=1444099&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/inactivity/InactivityMonitor.cpp
Fri Feb  8 16:27:24 2013
@@ -447,6 +447,7 @@ void InactivityMonitor::startMonitorThre
 
         this->members->asyncTasks->addTask(this->members->asyncReadTask.get());
         this->members->asyncTasks->addTask(this->members->asyncWriteTask.get());
+        this->members->asyncTasks->start();
 
         this->members->readCheckTime = Math::min(this->members->localWireFormatInfo->getMaxInactivityDuration(),
                 this->members->remoteWireFormatInfo->getMaxInactivityDuration());

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/threads/CompositeTaskRunnerTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/threads/CompositeTaskRunnerTest.cpp?rev=1444099&r1=1444098&r2=1444099&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/threads/CompositeTaskRunnerTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/threads/CompositeTaskRunnerTest.cpp
Fri Feb  8 16:27:24 2013
@@ -68,6 +68,7 @@ void CompositeTaskRunnerTest::test() {
     runner.addTask( &task1 );
     runner.addTask( &task2 );
 
+    runner.start();
     runner.wakeup();
 
     while( attempts++ != 10 ) {

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/threads/DedicatedTaskRunnerTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/threads/DedicatedTaskRunnerTest.cpp?rev=1444099&r1=1444098&r2=1444099&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/threads/DedicatedTaskRunnerTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/threads/DedicatedTaskRunnerTest.cpp
Fri Feb  8 16:27:24 2013
@@ -31,44 +31,46 @@ using namespace decaf::lang;
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
-class SimpleCountingTask : public Task {
-private:
+namespace {
 
-    unsigned int count;
+    class SimpleCountingTask : public Task {
+    private:
 
-public:
+        unsigned int count;
 
-    SimpleCountingTask() : count(0) {}
-    virtual ~SimpleCountingTask() {}
+    public:
 
-    virtual bool iterate() {
+        SimpleCountingTask() : count(0) {}
+        virtual ~SimpleCountingTask() {}
 
-        count++;
-        return false;
-    }
+        virtual bool iterate() {
 
-    unsigned int getCount() const { return count; }
-};
+            count++;
+            return false;
+        }
 
-////////////////////////////////////////////////////////////////////////////////
-class InfiniteCountingTask : public Task {
-private:
+        unsigned int getCount() const { return count; }
+    };
+
+    class InfiniteCountingTask : public Task {
+    private:
 
-    unsigned int count;
+        unsigned int count;
 
-public:
+    public:
 
-    InfiniteCountingTask() : count(0) {}
-    virtual ~InfiniteCountingTask() {}
+        InfiniteCountingTask() : count(0) {}
+        virtual ~InfiniteCountingTask() {}
 
-    virtual bool iterate() {
+        virtual bool iterate() {
 
-        count++;
-        return true;
-    }
+            count++;
+            return true;
+        }
 
-    unsigned int getCount() const { return count; }
-};
+        unsigned int getCount() const { return count; }
+    };
+}
 
 ////////////////////////////////////////////////////////////////////////////////
 void DedicatedTaskRunnerTest::testSimple() {
@@ -82,6 +84,8 @@ void DedicatedTaskRunnerTest::testSimple
     CPPUNIT_ASSERT( simpleTask.getCount() == 0 );
     DedicatedTaskRunner simpleTaskRunner( &simpleTask );
 
+    simpleTaskRunner.start();
+
     simpleTaskRunner.wakeup();
     Thread::sleep( 250 );
     CPPUNIT_ASSERT( simpleTask.getCount() >= 1 );
@@ -92,11 +96,11 @@ void DedicatedTaskRunnerTest::testSimple
     InfiniteCountingTask infiniteTask;
     CPPUNIT_ASSERT( infiniteTask.getCount() == 0 );
     DedicatedTaskRunner infiniteTaskRunner( &infiniteTask );
+    infiniteTaskRunner.start();
     Thread::sleep( 500 );
     CPPUNIT_ASSERT( infiniteTask.getCount() != 0 );
     infiniteTaskRunner.shutdown();
     unsigned int count = infiniteTask.getCount();
     Thread::sleep( 250 );
     CPPUNIT_ASSERT( infiniteTask.getCount() == count );
-
 }



Mime
View raw message