qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ritch...@apache.org
Subject svn commit: r637989 - /incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
Date Mon, 17 Mar 2008 17:44:58 GMT
Author: ritchiem
Date: Mon Mar 17 10:44:56 2008
New Revision: 637989

URL: http://svn.apache.org/viewvc?rev=637989&view=rev
Log:
QPID-857 : Reset the State Manager when receiveing a CLOSED state.

Modified:
    incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java

Modified: incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java?rev=637989&r1=637988&r2=637989&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
(original)
+++ incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
Mon Mar 17 10:44:56 2008
@@ -539,18 +539,24 @@
         {
 
             TransportConnection.getInstance(brokerDetail).connect(_protocolHandler, brokerDetail);
-             // this blocks until the connection has been set up or when an error
-             // has prevented the connection being set up
+            // this blocks until the connection has been set up or when an error
+            // has prevented the connection being set up
 
             //_protocolHandler.attainState(AMQState.CONNECTION_OPEN);
             AMQState state = _protocolHandler.attainState(openOrClosedStates);
-            if(state == AMQState.CONNECTION_OPEN)
+            if (state == AMQState.CONNECTION_OPEN)
             {
-
                 _failoverPolicy.attainedConnection();
 
                 // Again this should be changed to a suitable notify
                 _connected = true;
+            }
+            else if (state == AMQState.CONNECTION_CLOSED)
+            {
+                //We need to change protocol handler here as an error during the connect
will not
+                // cause the StateManager to be replaced. So the state is out of sync on
reconnect
+                // This occurs here when we need to re-negotiate protocol versions
+                _protocolHandler.getStateManager().changeState(AMQState.CONNECTION_NOT_STARTED);
             }
         }
         catch (AMQException e)



Mime
View raw message