Skip to content

Conversation

@zmarkan
Copy link
Contributor

@zmarkan zmarkan commented Mar 29, 2017

This would avoid the ConcurrentModificationException if unsubscribe/subscribe happens when connecting to the channel.

@zmarkan zmarkan force-pushed the bug/concurrentMoficiationException_when_iterating_channels branch from c10cd1b to 4c64b7b Compare March 29, 2017 10:16
channelNameToChannelMap.put(channel.getName(), channel);
sendOrQueueSubscribeMessage(channel);
synchronized (channelNameToChannelMap){
validateArgumentsAndBindEvents(channel, listener, eventNames);
Copy link
Contributor

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...

@zmarkan zmarkan force-pushed the bug/concurrentMoficiationException_when_iterating_channels branch 2 times, most recently from 054cafe to cc4e58e Compare March 29, 2017 10:39
if (connection.getState() == ConnectionState.CONNECTED) {
sendUnsubscribeMessage(channel);
}
final InternalChannel channel = channelNameToChannelMap.remove(channelName);
Copy link
Contributor

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) {
Copy link
Contributor

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.

@mdpye
Copy link
Contributor

mdpye commented Mar 29, 2017

Your editor seems to have changed the indentation on lots of otherwise unchanged lines

@zmarkan zmarkan force-pushed the bug/concurrentMoficiationException_when_iterating_channels branch from cc4e58e to 65a9f5a Compare March 29, 2017 10:52
@zmarkan zmarkan force-pushed the bug/concurrentMoficiationException_when_iterating_channels branch from 65a9f5a to 6485a0c Compare March 29, 2017 10:54
@zmarkan zmarkan merged commit b0a83eb into master Mar 29, 2017
@zmarkan zmarkan deleted the bug/concurrentMoficiationException_when_iterating_channels branch March 29, 2017 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants