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/01/26 03:49:56 UTC

svn commit: r500117 - in /incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq: connector/stomp/StompConnector.cpp connector/stomp/StompSessionManager.cpp transport/IOTransport.cpp

Author: nmittler
Date: Thu Jan 25 18:49:55 2007
New Revision: 500117

URL: http://svn.apache.org/viewvc?view=rev&rev=500117
Log:
[AMQCPP-46] - Fixing run on windows

Modified:
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompConnector.cpp
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompSessionManager.cpp
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.cpp

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompConnector.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompConnector.cpp?view=diff&rev=500117&r1=500116&r2=500117
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompConnector.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompConnector.cpp Thu Jan 25 18:49:55 2007
@@ -280,8 +280,12 @@
 
         // Send the disconnect command to the broker.
         DisconnectCommand cmd;
-        transport->oneway( &cmd );
-    }
+		transport->oneway( &cmd );
+
+    } catch( CommandIOException& ex ){
+		transport->close();
+		throw ex;
+	}
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException );
 }
@@ -463,8 +467,13 @@
         }
         
         // Send it
-        transport->oneway( command );
+		transport->oneway( command );
     }
+	catch( CommandIOException& ex ){
+		transport->close();
+		throw ConnectorException( __FILE__, __LINE__, 
+			ex.what() );
+	}
     AMQ_CATCH_RETHROW( ConnectorException )
     AMQ_CATCHALL_THROW( ConnectorException );
 }
@@ -521,10 +530,15 @@
                     Integer::toString( 
                         session->getTransactionInfo()->getTransactionId() ) );
             }
-            
-            transport->oneway( &cmd );
+
+			transport->oneway( &cmd );			
         }
     }
+	catch( CommandIOException& ex ){
+		transport->close();
+		throw ConnectorException( __FILE__, __LINE__, 
+			ex.what() );
+	}
     AMQ_CATCH_RETHROW( ConnectorException )
     AMQ_CATCHALL_THROW( ConnectorException );
 }
@@ -548,11 +562,16 @@
 
         cmd.setTransactionId( 
                 Integer::toString( transaction->getTransactionId() ) );
-        
-        transport->oneway( &cmd );
-        
+
+		transport->oneway( &cmd );
+
         return transaction;
     }
+	catch( CommandIOException& ex ){
+		transport->close();
+		throw ConnectorException( __FILE__, __LINE__, 
+			ex.what() );
+	}
     AMQ_CATCH_RETHROW( ConnectorException )
     AMQ_CATCHALL_THROW( ConnectorException );
     return NULL;
@@ -574,6 +593,11 @@
         
         transport->oneway( &cmd );
     }
+	catch( CommandIOException& ex ){
+		transport->close();
+		throw ConnectorException( __FILE__, __LINE__, 
+			ex.what() );
+	}
     AMQ_CATCH_RETHROW( ConnectorException )
     AMQ_CATCHALL_THROW( ConnectorException );
 }
@@ -594,6 +618,11 @@
         
         transport->oneway( &cmd );
     }
+	catch( CommandIOException& ex ){
+		transport->close();
+		throw ConnectorException( __FILE__, __LINE__, 
+			ex.what() );
+	}
     AMQ_CATCH_RETHROW( ConnectorException )
     AMQ_CATCHALL_THROW( ConnectorException );
 }

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompSessionManager.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompSessionManager.cpp?view=diff&rev=500117&r1=500116&r2=500117
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompSessionManager.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompSessionManager.cpp Thu Jan 25 18:49:55 2007
@@ -190,8 +190,14 @@
                     cmd.setMessageSelector( selector );
                 }
         
-                // Fire the message        
-                transport->oneway( &cmd );
+                // Fire the message   
+                try{
+                    transport->oneway( &cmd );
+                } catch( CommandIOException& ex ){
+                    transport->close();
+                    throw StompConnectorException( __FILE__, __LINE__, 
+                        ex.what() );
+                }
             }
              
             // Initialize a new Consumer info Message
@@ -247,7 +253,13 @@
                     consumer->getDestination().toProviderString() );
                 
                 // Send the message
-                transport->oneway( &cmd );
+                try{
+                    transport->oneway( &cmd );
+                } catch( CommandIOException& ex ){
+                    transport->close();
+                    throw StompConnectorException( __FILE__, __LINE__, 
+                        ex.what() );
+                }
             }    
         }
     }

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.cpp?view=diff&rev=500117&r1=500116&r2=500117
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.cpp Thu Jan 25 18:49:55 2007
@@ -52,6 +52,11 @@
 void IOTransport::oneway( Command* command ) 
     throw(CommandIOException, exceptions::UnsupportedOperationException)
 {
+    if( closed ){
+        throw CommandIOException( __FILE__, __LINE__, 
+            "IOTransport::oneway() - transport is closed!" );
+    }
+
     // Make sure the thread has been started.
     if( thread == NULL ){
         throw CommandIOException( 
@@ -114,6 +119,10 @@
 void IOTransport::close() throw( cms::CMSException ){
     
     try{
+        if( closed ){
+            return;
+        }
+
         // Mark this transport as closed.
         closed = true;