ARTEMIS-3929 Improving OpenWire clientIDSet

I have seen this contention while I was testing ARTEMIS-3928

This does change any semantics and current tests should be enough to validate this change
This commit is contained in:
Clebert Suconic 2022-08-07 22:20:45 -04:00 committed by clebertsuconic
parent 12b81e7a25
commit 568eb70fcd
1 changed files with 34 additions and 38 deletions

View File

@ -106,7 +106,7 @@ public class OpenWireProtocolManager extends AbstractProtocolManager<Command, O
private final CopyOnWriteArrayList<OpenWireConnection> connections = new CopyOnWriteArrayList<>();
private final Map<String, AMQConnectionContext> clientIdSet = new HashMap<>();
private final Map<String, AMQConnectionContext> clientIdSet = new ConcurrentHashMap<>();
private String brokerName;
@ -226,7 +226,6 @@ public class OpenWireProtocolManager extends AbstractProtocolManager<Command, O
}
public void removeConnection(ConnectionInfo info, Throwable error) throws InvalidClientIDException {
synchronized (clientIdSet) {
String clientId = info.getClientId();
if (clientId != null) {
AMQConnectionContext context = this.clientIdSet.remove(clientId);
@ -239,7 +238,6 @@ public class OpenWireProtocolManager extends AbstractProtocolManager<Command, O
throw new InvalidClientIDException("No clientID specified for connection disconnect request");
}
}
}
/*** if set, the OpenWire connection will bypass the tcpReadBuferSize and use this value instead.
* This is by default -1, and it should not be used unless in extreme situations like on a slow storage. */
@ -404,7 +402,6 @@ public class OpenWireProtocolManager extends AbstractProtocolManager<Command, O
throw new InvalidClientIDException("No clientID specified for connection request");
}
synchronized (clientIdSet) {
AMQConnectionContext context;
context = clientIdSet.get(clientId);
if (context != null) {
@ -433,7 +430,6 @@ public class OpenWireProtocolManager extends AbstractProtocolManager<Command, O
// init the conn
context.getConnection().addSessions(context.getConnectionState().getSessionIds());
}
}
public void fireAdvisory(AMQConnectionContext context, ActiveMQTopic topic, Command copy) throws Exception {
this.fireAdvisory(context, topic, copy, null, null);