You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use-case: application needs to listen for one specific event to occur. Once the event has been handled, the listener should be removed so that the handler isn't triggered for any future events of that type. The easiest way to do this is for the event handler to remove itself.
The listeners are in a List and the events are dispatched by iterating the list as follows:
This of course results in a ConcurrentModificationException. Should an iterator be used instead, or is there another preferred way to do this?
Example:
ReactionAddedListener reactionAddedListener = new ReactionAddedListener() {
@Override
public void onEvent(ReactionAdded event, SlackSession session) {
// do something here
session.removeReactionAddedListener(this);
}
The text was updated successfully, but these errors were encountered:
joeltoby
added a commit
to joeltoby/simple-slack-api
that referenced
this issue
Jan 28, 2017
Use-case: application needs to listen for one specific event to occur. Once the event has been handled, the listener should be removed so that the handler isn't triggered for any future events of that type. The easiest way to do this is for the event handler to remove itself.
The listeners are in a
List
and the events are dispatched by iterating the list as follows:( SlackWebSocketSessionImpl.java#dispatchImpl )
This of course results in a
ConcurrentModificationException
. Should an iterator be used instead, or is there another preferred way to do this?Example:
The text was updated successfully, but these errors were encountered: