[prev in list] [next in list] [prev in thread] [next in thread]
List: activemq-commits
Subject: svn commit: r501860 - in
From: tabish () apache ! org
Date: 2007-01-31 15:16:36
Message-ID: 20070131151636.9C2D51A981A () eris ! apache ! org
[Download RAW message or body]
Author: tabish
Date: Wed Jan 31 07:16:35 2007
New Revision: 501860
URL: http://svn.apache.org/viewvc?view=rev&rev=501860
Log:
http://issues.apache.org/activemq/browse/AMQCPP-63
Fixed a potential memory leak in the Session.
Modified:
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/s \
rc/main/activemq/core/ActiveMQSession.cpp?view=diff&rev=501860&r1=501859&r2=501860 \
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp \
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp \
Wed Jan 31 07:16:35 2007 @@ -124,6 +124,9 @@
// Stop the Async Thread if its running
stopThread();
+
+ // Remove any unsent cloned messages.
+ purgeMessages();
}
AMQ_CATCH_NOTHROW( ActiveMQException )
AMQ_CATCHALL_NOTHROW( )
@@ -743,6 +746,26 @@
asyncThread = NULL;
}
}
+ AMQ_CATCH_RETHROW( ActiveMQException )
+ AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQSession::purgeMessages() throw ( ActiveMQException )
+{
+ try
+ {
+ synchronized( &msgQueue )
+ {
+ while( !msgQueue.empty() )
+ {
+ // destroy these messages if this is not a transacted
+ // session, if it is then the tranasction will clean
+ // the messages up.
+ delete msgQueue.pop().first;
+ }
+ }
+ }
AMQ_CATCH_RETHROW( ActiveMQException )
AMQ_CATCHALL_THROW( ActiveMQException )
}
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h?view=diff&rev=501860&r1=501859&r2=501860
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h \
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h \
Wed Jan 31 07:16:35 2007 @@ -331,12 +331,18 @@
* is invoked, which means that the caller is choosing to use this
* consumer asynchronously instead of synchronously (receive).
*/
- void startThread() throw (exceptions::ActiveMQException);
+ void startThread() throw ( exceptions::ActiveMQException );
/**
* Stops the asynchronous message processing thread if it's started.
*/
- void stopThread() throw (exceptions::ActiveMQException);
+ void stopThread() throw ( exceptions::ActiveMQException );
+
+ /**
+ * Purges all messages currently in the queue. This can be as a
+ * result of a rollback, or of the consumer being shutdown.
+ */
+ virtual void purgeMessages() throw ( exceptions::ActiveMQException );
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic