diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2009-10-08 08:17:33 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2009-10-08 08:17:33 +0000 |
| commit | c3f975ff714ab0077e9946c29556edc3ed5db476 (patch) | |
| tree | b1183df76defe3fae7db2acd2b26eb524357a1eb /java/client/src | |
| parent | d5c872e6f0e840de21cb47f882f45c9412873061 (diff) | |
| download | qpid-python-c3f975ff714ab0077e9946c29556edc3ed5db476.tar.gz | |
QPID-1950 : Problem is that the thrown exception whilst an IOException does not signify that the socket has closed. So the broker had two open connections to send messages on. Change was to ensure that the previous Socket/IOSession has been closed before failover starts. Also added protected to ChannelOpenHandler to guard against out of order frames causing a NPE.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@823087 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src')
| -rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/failover/FailoverHandler.java | 11 |
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()); |
