Author: tabish
Date: Mon Apr 8 15:27:37 2013
New Revision: 1465665
URL: http://svn.apache.org/r1465665
Log:
fix and test for: https://issues.apache.org/jira/browse/AMQCPP-474
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTempDestinationTest.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTempDestinationTest.h
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp?rev=1465665&r1=1465664&r2=1465665&view=diff
==============================================================================
---
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
(original)
+++
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
Mon Apr 8 15:27:37 2013
@@ -1876,12 +1876,12 @@ void ActiveMQConnection::cleanUpTempDest
return;
}
- Pointer<Iterator<Pointer<ActiveMQTempDestination> > >
iterator(this->config->activeTempDestinations.values().iterator());
+ ArrayList< Pointer<ActiveMQTempDestination> >
tempDests(this->config->activeTempDestinations.values());
+ Pointer<Iterator<Pointer<ActiveMQTempDestination> > >
iterator(tempDests.iterator());
while (iterator->hasNext()) {
Pointer<ActiveMQTempDestination> dest = iterator->next();
try {
-
// Only delete this temporary destination if it was created from
this connection, since the
// advisory consumer tracks all temporary destinations there can
be others in our mapping that
// this connection did not create.
@@ -1890,7 +1890,6 @@ void ActiveMQConnection::cleanUpTempDest
if (dest->getConnectionId() == thisConnectionId) {
this->deleteTempDestination(dest);
}
-
} catch (Exception& ex) {
}
}
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTempDestinationTest.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTempDestinationTest.cpp?rev=1465665&r1=1465664&r2=1465665&view=diff
==============================================================================
---
activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTempDestinationTest.cpp
(original)
+++
activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTempDestinationTest.cpp
Mon Apr 8 15:27:37 2013
@@ -24,6 +24,7 @@
#include <decaf/util/ArrayList.h>
#include <activemq/exceptions/ActiveMQException.h>
#include <activemq/core/ActiveMQConnectionFactory.h>
+#include <decaf/util/ArrayList.h>
using namespace std;
using namespace cms;
@@ -38,9 +39,9 @@ using namespace decaf::util;
using namespace decaf::util::concurrent;
using namespace decaf::lang;
-namespace activemq{
-namespace test{
-namespace openwire{
+namespace activemq {
+namespace test {
+namespace openwire {
class Requester : public cms::MessageListener,
public decaf::lang::Runnable {
@@ -414,3 +415,22 @@ void OpenwireTempDestinationTest::testDe
queue->destroy(),
CMSException);
}
+
+///////////////////////////////////////////////////////////////////////////////
+void OpenwireTempDestinationTest::testCloseConnectionWithManyTempDests() {
+
+ ArrayList< Pointer<TemporaryQueue> > tempQueues;
+ ArrayList< Pointer<MessageProducer> > producers;
+
+ for (int i = 0; i < 25; ++i) {
+ Pointer<TemporaryQueue>
tempQueue(cmsProvider->getSession()->createTemporaryQueue());
+ tempQueues.add(tempQueue);
+ Pointer<MessageProducer>
producer(cmsProvider->getSession()->createProducer(tempQueue.get()));
+ producers.add(producer);
+ }
+
+ cmsProvider->getConnection()->close();
+
+ tempQueues.clear();
+ producers.clear();
+}
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTempDestinationTest.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTempDestinationTest.h?rev=1465665&r1=1465664&r2=1465665&view=diff
==============================================================================
---
activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTempDestinationTest.h
(original)
+++
activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireTempDestinationTest.h
Mon Apr 8 15:27:37 2013
@@ -36,6 +36,7 @@ namespace openwire{
CPPUNIT_TEST( testPublishFailsForClosedConnection );
CPPUNIT_TEST( testPublishFailsForDestoryedTempDestination );
CPPUNIT_TEST( testDeleteDestinationWithSubscribersFails );
+ CPPUNIT_TEST( testCloseConnectionWithManyTempDests );
CPPUNIT_TEST_SUITE_END();
public:
@@ -52,6 +53,7 @@ namespace openwire{
void testPublishFailsForClosedConnection();
void testPublishFailsForDestoryedTempDestination();
void testDeleteDestinationWithSubscribersFails();
+ void testCloseConnectionWithManyTempDests();
virtual std::string getBrokerURL() const {
return
activemq::util::IntegrationCommon::getInstance().getOpenwireURL();