-
Notifications
You must be signed in to change notification settings - Fork 140
Synchronise access to channelNameToChannelMap #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Synchronise access to channelNameToChannelMap #142
Conversation
c10cd1b to
4c64b7b
Compare
| channelNameToChannelMap.put(channel.getName(), channel); | ||
| sendOrQueueSubscribeMessage(channel); | ||
| synchronized (channelNameToChannelMap){ | ||
| validateArgumentsAndBindEvents(channel, listener, eventNames); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need these non-map accesses to be inside the critical section? Some of them may also take locks...
054cafe to
cc4e58e
Compare
| if (connection.getState() == ConnectionState.CONNECTED) { | ||
| sendUnsubscribeMessage(channel); | ||
| } | ||
| final InternalChannel channel = channelNameToChannelMap.remove(channelName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong indentation.
|
|
||
| for (final InternalChannel channel : channelNameToChannelMap.values()) { | ||
| sendOrQueueSubscribeMessage(channel); | ||
| if (change.getCurrentState() == ConnectionState.CONNECTED) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this new indentation.
|
Your editor seems to have changed the indentation on lots of otherwise unchanged lines |
cc4e58e to
65a9f5a
Compare
65a9f5a to
6485a0c
Compare
This would avoid the ConcurrentModificationException if unsubscribe/subscribe happens when connecting to the channel.