Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 61729 invoked from network); 24 Feb 2008 22:35:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Feb 2008 22:35:35 -0000 Received: (qmail 23119 invoked by uid 500); 24 Feb 2008 22:35:30 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 23092 invoked by uid 500); 24 Feb 2008 22:35:30 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 23083 invoked by uid 99); 24 Feb 2008 22:35:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 24 Feb 2008 14:35:30 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 24 Feb 2008 22:35:05 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5B49E1A9832; Sun, 24 Feb 2008 14:35:14 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r630693 - /activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/OpenWireConnector.cpp Date: Sun, 24 Feb 2008 22:35:14 -0000 To: commits@activemq.apache.org From: nmittler@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080224223514.5B49E1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 =