summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2008-03-17 17:44:56 +0000
committerMartin Ritchie <ritchiem@apache.org>2008-03-17 17:44:56 +0000
commitddd769ed901ea44163dd154ea978957d5dddeed7 (patch)
treef0e4b2412afcdf8bdaba60e87846370e6684c487
parentc10241126321f173df7a3c77fb5c049c298029f8 (diff)
downloadqpid-python-ddd769ed901ea44163dd154ea978957d5dddeed7.tar.gz
QPID-857 : Reset the State Manager when receiveing a CLOSED state.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2.1@637989 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/AMQConnection.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java b/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
index 7a54617bf1..8cbcda053b 100644
--- a/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
+++ b/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
@@ -539,19 +539,25 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect
{
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)
{