activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nmitt...@apache.org
Subject svn commit: r630693 - /activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireConnector.cpp
Date Sun, 24 Feb 2008 22:35:14 GMT
Author: nmittler
Date: Sun Feb 24 14:35:13 2008
New Revision: 630693

URL: http://svn.apache.org/viewvc?rev=630693&view=rev
Log: (empty)

Modified:
    activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireConnector.cpp

Modified: activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireConnector.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireConnector.cpp?rev=630693&r1=630692&r2=630693&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireConnector.cpp
(original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireConnector.cpp
Sun Feb 24 14:35:13 2008
@@ -83,7 +83,10 @@
     // Create our WireFormatFactory on the stack, only need it once.
     OpenWireFormatFactory wireFormatFactory;
 
-    this->state = CONNECTION_STATE_DISCONNECTED;
+    synchronized( &mutex ) {
+        this->state = CONNECTION_STATE_DISCONNECTED;
+    }
+    
     this->exceptionListener = NULL;
     this->messageListener = NULL;
     this->brokerInfo = NULL;
@@ -143,7 +146,7 @@
                     __FILE__, __LINE__,
                     "OpenWireConnector::start - already started" );
             }
-
+            
             // Start the transport - this establishes the socket.
             transport->start();
 
@@ -169,7 +172,7 @@
 
             // Send the disconnect message to the broker.
             disconnect();
-
+            
             // Close the transport now that we've sent the last messages..
             transport->close();
         }
@@ -184,8 +187,10 @@
 
     try{
 
-        // Mark this connector as started.
-        state = CONNECTION_STATE_CONNECTING;
+        synchronized( &mutex ) {
+            // Mark this connector as started.
+            state = CONNECTION_STATE_CONNECTING;
+        }
 
         // Fill in our connection info.
         connectionInfo.setUserName( getUsername() );
@@ -203,12 +208,14 @@
         commands::ConnectionId* connectionId = new commands::ConnectionId();
         connectionId->setValue( UUID::randomUUID().toString() );
         connectionInfo.setConnectionId( connectionId );
-
+                    
         // Now we ping the broker and see if we get an ack / nack
         Response* response = syncRequest( &connectionInfo );
 
-        // Tag us in the Connected State now.
-        state = CONNECTION_STATE_CONNECTED;
+        synchronized( &mutex ) {
+            // Tag us in the Connected State now.
+            state = CONNECTION_STATE_CONNECTED;
+        }
 
         // Clean up the ack
         delete response;
@@ -223,8 +230,10 @@
 
     try{
 
-        // Mark state as no longer connected.
-        state = CONNECTION_STATE_DISCONNECTED;
+        synchronized( &mutex ) {
+            // Mark state as no longer connected.
+            state = CONNECTION_STATE_DISCONNECTED;
+        }
 
         // Remove our ConnectionId from the Broker
         disposeOf( connectionInfo.getConnectionId() );
@@ -1394,10 +1403,12 @@
         if( state == CONNECTION_STATE_DISCONNECTED ){
             return;
         }
-
-        // Mark the fact that we are in an error state
-        state = CONNECTION_STATE_ERROR;
-
+                    
+        synchronized( &mutex ) {
+            // Mark the fact that we are in an error state
+            state = CONNECTION_STATE_ERROR;
+        }
+                    
         // Inform the user of the error.
         fire( ex );
     }
@@ -1423,7 +1434,7 @@
     throw ( ConnectorException ) {
 
     try {
-
+                    
         Response* response = transport->request( command );
 
         commands::ExceptionResponse* exceptionResponse =



Mime
View raw message