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/10/03 00:16:10 UTC
svn commit: r1393212 -
/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/transport/correlator/ResponseCorrelator.cpp
Author: tabish
Date: Tue Oct 2 22:16:10 2012
New Revision: 1393212
URL: http://svn.apache.org/viewvc?rev=1393212&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQCPP-429
Modified:
activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/transport/correlator/ResponseCorrelator.cpp
Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/transport/correlator/ResponseCorrelator.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/transport/correlator/ResponseCorrelator.cpp?rev=1393212&r1=1393211&r2=1393212&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/transport/correlator/ResponseCorrelator.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/transport/correlator/ResponseCorrelator.cpp Tue Oct 2 22:16:10 2012
@@ -65,8 +65,11 @@ ResponseCorrelator::ResponseCorrelator(
////////////////////////////////////////////////////////////////////////////////
ResponseCorrelator::~ResponseCorrelator(){
- // Close the transport and destroy it.
- close();
+ try {
+ // Close the transport and destroy it.
+ close();
+ }
+ AMQ_CATCHALL_NOTHROW()
}
////////////////////////////////////////////////////////////////////////////////
@@ -103,7 +106,11 @@ Pointer<Response> ResponseCorrelator::re
Pointer<FutureResponse> futureResponse( new FutureResponse() );
synchronized( &mapMutex ){
- requestMap.insert( make_pair( (unsigned int)command->getCommandId(), futureResponse ) );
+ if (!closed) {
+ requestMap.insert( make_pair( (unsigned int)command->getCommandId(), futureResponse ) );
+ } else {
+ throw IOException(__FILE__, __LINE__, "Transport is closed");
+ }
}
// The finalizer will cleanup the map even if an exception is thrown.
@@ -147,7 +154,11 @@ Pointer<Response> ResponseCorrelator::re
Pointer<FutureResponse> futureResponse( new FutureResponse() );
synchronized( &mapMutex ){
- requestMap.insert( make_pair( (unsigned int)command->getCommandId(), futureResponse ) );
+ if (!closed) {
+ requestMap.insert( make_pair( (unsigned int)command->getCommandId(), futureResponse ) );
+ } else {
+ throw IOException(__FILE__, __LINE__, "Transport is closed");
+ }
}
// The finalizer will cleanup the map even if an exception is thrown.
@@ -200,11 +211,6 @@ void ResponseCorrelator::onCommand( cons
std::map< unsigned int, Pointer<FutureResponse> >::iterator iter =
requestMap.find( response->getCorrelationId() );
if( iter == requestMap.end() ){
-
- // This is not terrible - just log it.
- //printf( "ResponseCorrelator::onCommand() - "
- // "received unknown response for request: %d\n",
- // response->getCorrelationId() );
return;
}