summaryrefslogtreecommitdiff
path: root/java/client
diff options
context:
space:
mode:
Diffstat (limited to 'java/client')
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/failover/FailoverHandler.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/failover/FailoverHandler.java b/java/client/src/main/java/org/apache/qpid/client/failover/FailoverHandler.java
index 927f660932..7fa7004a9e 100644
--- a/java/client/src/main/java/org/apache/qpid/client/failover/FailoverHandler.java
+++ b/java/client/src/main/java/org/apache/qpid/client/failover/FailoverHandler.java
@@ -140,6 +140,17 @@ public class FailoverHandler implements Runnable
// a slightly more complex state model therefore I felt it was worthwhile doing this.
AMQStateManager existingStateManager = _amqProtocolHandler.getStateManager();
+
+ // We are failing over so lets ensure any existing ProtocolSessions
+ // are closed. Closing them will update the stateManager which we
+ // probably don't want to record the change to the closed state.
+ // So lets make a new one.
+ _amqProtocolHandler.setStateManager(new AMQStateManager());
+
+ // Close the session, false says don't wait for it to close, just close it.
+ _amqProtocolHandler.getProtocolSession().closeProtocolSession(false);
+
+ // Use a fresh new StateManager for the reconnection attempts
_amqProtocolHandler.setStateManager(new AMQStateManager());