You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by nm...@apache.org on 2007/02/18 13:53:42 UTC
svn commit: r508899 -
/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireConnector.cpp
Author: nmittler
Date: Sun Feb 18 04:53:41 2007
New Revision: 508899
URL: http://svn.apache.org/viewvc?view=rev&rev=508899
Log:
[AMQCPP-30] setting SessionInfo property in producers and consumers
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireConnector.cpp
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireConnector.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireConnector.cpp?view=diff&rev=508899&r1=508898&r2=508899
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireConnector.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireConnector.cpp Sun Feb 18 04:53:41 2007
@@ -301,16 +301,15 @@
oneway( &shutdown );
} catch( ConnectorException& ex ){
- try{
- transport->close();
- } catch( cms::CMSException& e ){}
+ try{ transport->close(); } catch( ... ){}
+
+ ex.setMark(__FILE__,__LINE__);
throw ex;
} catch( ... ) {
- try{
- transport->close();
- } catch( cms::CMSException& e ){}
+ try{ transport->close(); } catch( ... ){}
- throw OpenWireConnectorException(__FILE__, __LINE__, "Caught unknown exception" );
+ throw OpenWireConnectorException(__FILE__, __LINE__,
+ "Caught unknown exception" );
}
}
@@ -379,6 +378,7 @@
enforceConnected();
consumer = new OpenWireConsumerInfo();
+ consumer->setSessionInfo( session );
consumerInfo = createConsumerInfo( destination, session );
consumer->setConsumerInfo( consumerInfo );
@@ -434,6 +434,7 @@
enforceConnected();
consumer = new OpenWireConsumerInfo();
+ consumer->setSessionInfo( session );
consumerInfo = createConsumerInfo( topic, session );
consumer->setConsumerInfo( consumerInfo );
@@ -563,6 +564,8 @@
enforceConnected();
producer = new OpenWireProducerInfo();
+ producer->setSessionInfo( session );
+
producerInfo = new commands::ProducerInfo();
producer->setProducerInfo( producerInfo );
@@ -712,7 +715,7 @@
"Producer was not of the OpenWire flavor.");
}
- const SessionInfo* session = producerInfo->getSessionInfo();
+ const SessionInfo* session = producerInfo->getSessionInfo();
commands::Message* amqMessage =
dynamic_cast< commands::Message* >( message );
@@ -765,14 +768,20 @@
// The broker did not return an error - this is good.
// Just discard the response.
delete response;
+
+ } catch( ConnectorException& ex ){
+
+ try{ transport->close(); } catch( ... ){}
+
+ ex.setMark(__FILE__,__LINE__);
+ throw ex;
+ } catch( ... ) {
+
+ try{ transport->close(); } catch( ... ){}
+
+ throw OpenWireConnectorException( __FILE__, __LINE__,
+ "Caught unknown exception" );
}
- catch( CommandIOException& ex ){
- transport->close();
- throw ConnectorException( __FILE__, __LINE__,
- ex.what() );
- }
- AMQ_CATCH_RETHROW( ConnectorException )
- AMQ_CATCHALL_THROW( OpenWireConnectorException )
}
////////////////////////////////////////////////////////////////////////////////
@@ -863,16 +872,20 @@
getTransactionId()->cloneDataStructure() ) );
}
- transport->oneway( &ack );
+ oneway( &ack );
}
+ } catch( ConnectorException& ex ){
+ try{ transport->close(); } catch( ... ){}
+
+ ex.setMark(__FILE__,__LINE__);
+ throw ex;
+ } catch( ... ) {
+
+ try{ transport->close(); } catch( ... ){}
+
+ throw OpenWireConnectorException( __FILE__, __LINE__,
+ "Caught unknown exception" );
}
- catch( CommandIOException& ex ){
- transport->close();
- throw ConnectorException( __FILE__, __LINE__,
- ex.what() );
- }
- AMQ_CATCH_RETHROW( ConnectorException )
- AMQ_CATCHALL_THROW( OpenWireConnectorException )
}
////////////////////////////////////////////////////////////////////////////////
@@ -901,21 +914,23 @@
info->setTransactionId( createLocalTransactionId() );
info->setType( (int)TRANSACTION_BEGIN );
- transport->oneway( info );
+ oneway( info );
// Store for later
transaction->setTransactionInfo( info );
return transaction;
+ } catch( ConnectorException& ex ){
+ try{ transport->close(); } catch( ... ){}
+ ex.setMark(__FILE__,__LINE__);
+ throw ex;
+ } catch( ... ) {
+
+ try{ transport->close(); } catch( ... ){}
+
+ throw OpenWireConnectorException( __FILE__, __LINE__,
+ "Caught unknown exception" );
}
- catch( CommandIOException& ex ){
- transport->close();
- throw ConnectorException( __FILE__, __LINE__,
- ex.what() );
- }
- AMQ_CATCH_RETHROW( ConnectorException )
- AMQ_CATCHALL_THROW( OpenWireConnectorException )
- return NULL;
}
////////////////////////////////////////////////////////////////////////////////
@@ -942,15 +957,18 @@
info->setType( (int)TRANSACTION_COMMITONEPHASE );
- transport->oneway( info );
- }
- catch( CommandIOException& ex ){
- transport->close();
- throw ConnectorException( __FILE__, __LINE__,
- ex.what() );
+ oneway( info );
+ } catch( ConnectorException& ex ){
+ try{ transport->close(); } catch( ... ){}
+ ex.setMark(__FILE__,__LINE__);
+ throw ex;
+ } catch( ... ) {
+
+ try{ transport->close(); } catch( ... ){}
+
+ throw OpenWireConnectorException( __FILE__, __LINE__,
+ "Caught unknown exception" );
}
- AMQ_CATCH_RETHROW( ConnectorException )
- AMQ_CATCHALL_THROW( OpenWireConnectorException )
}
////////////////////////////////////////////////////////////////////////////////
@@ -977,15 +995,18 @@
info->setType( (int)TRANSACTION_ROLLBACK );
- transport->oneway( info );
- }
- catch( CommandIOException& ex ){
- transport->close();
- throw ConnectorException( __FILE__, __LINE__,
- ex.what() );
+ oneway( info );
+ } catch( ConnectorException& ex ){
+ try{ transport->close(); } catch( ... ){}
+ ex.setMark(__FILE__,__LINE__);
+ throw ex;
+ } catch( ... ) {
+
+ try{ transport->close(); } catch( ... ){}
+
+ throw OpenWireConnectorException( __FILE__, __LINE__,
+ "Caught unknown exception" );
}
- AMQ_CATCH_RETHROW( ConnectorException )
- AMQ_CATCHALL_THROW( OpenWireConnectorException )
}
////////////////////////////////////////////////////////////////////////////////