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 2007/03/18 14:33:11 UTC
svn commit: r519610 -
/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
Author: tabish
Date: Sun Mar 18 06:33:11 2007
New Revision: 519610
URL: http://svn.apache.org/viewvc?view=rev&rev=519610
Log:
https://issues.apache.org/activemq/browse/AMQCPP-92
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp?view=diff&rev=519610&r1=519609&r2=519610
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp Sun Mar 18 06:33:11 2007
@@ -72,7 +72,7 @@
transaction =
new ActiveMQTransaction(connection, this, properties );
}
-
+
// Create the session executor object.
executor = new ActiveMQSessionExecutor( this );
}
@@ -100,13 +100,13 @@
try
{
// Stop the dispatch executor.
- stop();
-
+ stop();
+
// Get the complete list of closeable session resources.
std::vector<cms::Closeable*> allResources;
synchronized( &closableSessionResources ) {
allResources = closableSessionResources.toArray();
- }
+ }
// Close all of the resources.
for( unsigned int ix=0; ix<allResources.size(); ++ix ){
@@ -124,8 +124,9 @@
transaction = NULL;
}
- // Destroy this sessions resources
+ // Remove this sessions from the connector
connection->removeSession( this );
+ delete sessionInfo;
sessionInfo = NULL;
// Now indicate that this session is closed.
@@ -136,7 +137,7 @@
// Remove any unsent cloned messages.
purgeMessages();
-
+
delete executor;
executor = NULL;
}
@@ -239,18 +240,18 @@
"ActiveMQSession::createConsumer - Session Already Closed" );
}
- ConsumerInfo* consumerInfo =
+ ConsumerInfo* consumerInfo =
connection->getConnectionData()->getConnector()->
createConsumer( destination,
sessionInfo,
selector,
noLocal );
- // Add to Session Closeables and Monitor for close, if needed.
+ // Add to Session Closeables and Monitor for close, if needed.
checkConnectorResource(
dynamic_cast<ConnectorResource*>( consumerInfo ) );
- // Create the consumer instance.
+ // Create the consumer instance.
ActiveMQConsumer* consumer = new ActiveMQConsumer(
consumerInfo, this );
@@ -268,9 +269,9 @@
connection->getConnectionData()->getConnector()->startConsumer(
consumerInfo );
} catch( ActiveMQException& ex ) {
- synchronized( &consumers ) {
- consumers.remove( consumerInfo->getConsumerId() );
- }
+ synchronized( &consumers ) {
+ consumers.remove( consumerInfo->getConsumerId() );
+ }
delete consumer;
ex.setMark( __FILE__, __LINE__ );
throw ex;
@@ -325,9 +326,9 @@
connection->getConnectionData()->getConnector()->startConsumer(
consumerInfo );
} catch( ActiveMQException& ex ) {
- synchronized( &consumers ) {
- consumers.remove( consumerInfo->getConsumerId() );
- }
+ synchronized( &consumers ) {
+ consumers.remove( consumerInfo->getConsumerId() );
+ }
delete consumer;
ex.setMark( __FILE__, __LINE__ );
throw ex;
@@ -717,7 +718,7 @@
if( consumer != NULL )
{
// Remove the dispatcher for the Connection
- connection->removeDispatcher( consumer );
+ connection->removeDispatcher( consumer );
// Remove this consumer from the Transaction if we are
// transactional
@@ -725,7 +726,7 @@
transaction->removeFromTransaction(
consumer->getConsumerId() );
}
-
+
// Remove this consumer from the consumers map.
synchronized( &consumers ) {
consumers.remove( consumer->getConsumerId() );
@@ -916,7 +917,7 @@
////////////////////////////////////////////////////////////////////////////////
void ActiveMQSession::dispatch( DispatchData& message ) {
-
+
if( executor != NULL ) {
executor->execute( message );
}
@@ -926,19 +927,19 @@
void ActiveMQSession::redispatch( util::Queue<DispatchData>& unconsumedMessages )
{
util::Queue<DispatchData> reversedList;
-
+
// Copy the list in reverse order then clear the original list.
synchronized( &unconsumedMessages ) {
unconsumedMessages.reverse( reversedList );
unconsumedMessages.clear();
}
-
+
// Add the list to the front of the executor.
while( !reversedList.empty() ) {
DispatchData data = reversedList.pop();
executor->executeFirst( data );
}
-
+
}
////////////////////////////////////////////////////////////////////////////////
@@ -963,7 +964,7 @@
if( executor == NULL ) {
return false;
}
-
+
return executor->isStarted();
}