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 2012/11/20 00:36:07 UTC
svn commit: r1411481 - in /activemq/activemq-cpp/trunk/activemq-cpp/src:
main/decaf/util/concurrent/ThreadPoolExecutor.cpp
test/decaf/util/concurrent/ThreadPoolExecutorTest.cpp
test/decaf/util/concurrent/ThreadPoolExecutorTest.h
Author: tabish
Date: Mon Nov 19 23:36:06 2012
New Revision: 1411481
URL: http://svn.apache.org/viewvc?rev=1411481&view=rev
Log:
Small tweak to ThreadPoolExecutor and a new unit test.
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ThreadPoolExecutor.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/ThreadPoolExecutorTest.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/ThreadPoolExecutorTest.h
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ThreadPoolExecutor.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ThreadPoolExecutor.cpp?rev=1411481&r1=1411480&r2=1411481&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ThreadPoolExecutor.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ThreadPoolExecutor.cpp Mon Nov 19 23:36:06 2012
@@ -1138,9 +1138,10 @@ namespace concurrent{
throw;
}
+ t->start();
+
mainLock.unlock();
- t->start();
// It is possible (but unlikely) for a thread to have been added to
// workers, but not yet started, during transition to STOP, which
// could result in a rare missed interrupt, because Thread::interrupt
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/ThreadPoolExecutorTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/ThreadPoolExecutorTest.cpp?rev=1411481&r1=1411480&r2=1411481&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/ThreadPoolExecutorTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/ThreadPoolExecutorTest.cpp Mon Nov 19 23:36:06 2012
@@ -1361,3 +1361,13 @@ void ThreadPoolExecutorTest::testConcurr
executor.shutdown();
CPPUNIT_ASSERT_MESSAGE("executor terminated", executor.awaitTermination(45, TimeUnit::SECONDS));
}
+
+////////////////////////////////////////////////////////////////////////////////
+void ThreadPoolExecutorTest::testRapidCreateAndDestroyExecutor() {
+
+ for (int i = 0; i < 100; i++) {
+ ThreadPoolExecutor executor(10, Integer::MAX_VALUE, 60LL, TimeUnit::SECONDS, new LinkedBlockingQueue<Runnable*>());
+ executor.shutdown();
+ CPPUNIT_ASSERT_MESSAGE("executor terminated", executor.awaitTermination(45, TimeUnit::SECONDS));
+ }
+}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/ThreadPoolExecutorTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/ThreadPoolExecutorTest.h?rev=1411481&r1=1411480&r2=1411481&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/ThreadPoolExecutorTest.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/ThreadPoolExecutorTest.h Mon Nov 19 23:36:06 2012
@@ -105,6 +105,7 @@ namespace concurrent{
CPPUNIT_TEST( testTerminated );
CPPUNIT_TEST( testBeforeAfter );
CPPUNIT_TEST( testConcurrentRandomDelayedThreads );
+ CPPUNIT_TEST( testRapidCreateAndDestroyExecutor );
CPPUNIT_TEST_SUITE_END();
private:
@@ -187,6 +188,7 @@ namespace concurrent{
void testTerminated();
void testBeforeAfter();
void testConcurrentRandomDelayedThreads();
+ void testRapidCreateAndDestroyExecutor();
};