clebertsuconic commented on code in PR #4700:
URL: https://github.com/apache/activemq-artemis/pull/4700#discussion_r1413912177
##########
artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java:
##########
@@ -244,18 +244,15 @@ public void nodeDown(long eventUID, String nodeID) {
}
}
- public void removeConnection(ConnectionInfo info, Throwable error) throws
InvalidClientIDException {
- String clientId = info.getClientId();
- if (clientId != null) {
- AMQConnectionContext context = this.clientIdSet.remove(clientId);
- if (context != null) {
- //connection is still there and need to close
- context.getConnection().disconnect(error != null);
- this.connections.remove(context.getConnection());
+ public void removeConnection(String clientID, OpenWireConnection
connection) {
+ synchronized (clientIdSet) {
Review Comment:
@gtully I had a check if the connection being removed was the original
connection.
Since ConcurrentHashMap has a remove(key, value), and only removing it if
the value is that value, then I can remove the sync point and use a
concurrentHashMap.
The only race is the remove.. since we should always put it on the
addConnection.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]