summaryrefslogtreecommitdiff
path: root/java/broker/src/main/java/org/apache
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2012-02-06 14:41:53 +0000
committerKeith Wall <kwall@apache.org>2012-02-06 14:41:53 +0000
commit405e7cf92aa57b3952563b15c64162b647baa5ac (patch)
tree47ff291978a82b491b5f1cc4c90ac1e6558ce0e9 /java/broker/src/main/java/org/apache
parente3e76f006919efb925dcdf24cb197f4d73f9a26d (diff)
downloadqpid-python-405e7cf92aa57b3952563b15c64162b647baa5ac.tar.gz
QPID-3756: Reorder Java Broker's connection close process so that ConnectionCloseOk is sent only after first updating its internal state.
This change means that the connection mbean will be deregistered from JMX before sending ConnectionCloseOk, thus removing the possibility of the race condition. The client side process is unaffected by this change. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1241024 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker/src/main/java/org/apache')
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionDelegate.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionDelegate.java b/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionDelegate.java
index 0bf65d388b..02c4ffa012 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionDelegate.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/transport/ServerConnectionDelegate.java
@@ -20,6 +20,8 @@
*/
package org.apache.qpid.server.transport;
+import static org.apache.qpid.transport.Connection.State.CLOSE_RCVD;
+
import org.apache.qpid.common.ServerPropertyNames;
import org.apache.qpid.properties.ConnectionStartProperties;
import org.apache.qpid.protocol.ProtocolEngine;
@@ -132,17 +134,20 @@ public class ServerConnectionDelegate extends ServerDelegate
}
}
+ @Override
public void connectionClose(Connection conn, ConnectionClose close)
{
+ final ServerConnection sconn = (ServerConnection) conn;
try
{
- ((ServerConnection) conn).logClosed();
+ sconn.logClosed();
}
finally
{
- super.connectionClose(conn, close);
+ sconn.closeCode(close);
+ sconn.setState(CLOSE_RCVD);
+ sendConnectionCloseOkAndCloseSender(conn);
}
-
}
public void connectionOpen(Connection conn, ConnectionOpen open)
@@ -196,7 +201,7 @@ public class ServerConnectionDelegate extends ServerDelegate
{
LOGGER.error("Connection '" + sconn.getConnectionId() + "' being severed, " +
"client connectionTuneOk returned a channelMax (" + okChannelMax +
- ") above the servers offered limit (" + getChannelMax() +")");
+ ") above the server's offered limit (" + getChannelMax() +")");
//Due to the error we must forcefully close the connection without negotiation
sconn.getSender().close();