1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 20:47:57 +01:00

Use a CopyOnWriteArraySet for joinedRooms

Since it is accessed concurrently. And also may cause a
ConcurrentModificationException when the MultiUserChatManager tries to
re-join the joined rooms.

Fixes SMACK-819.
This commit is contained in:
Florian Schmaus 2018-05-10 20:18:48 +02:00
parent cb27b02658
commit fd97f5ba0b

View file

@ -20,7 +20,6 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -134,7 +133,11 @@ public final class MultiUserChatManager extends Manager {
new NotFilter(MessageTypeFilter.ERROR));
private final Set<InvitationListener> invitationsListeners = new CopyOnWriteArraySet<InvitationListener>();
private final Set<EntityBareJid> joinedRooms = new HashSet<>();
/**
* The XMPP addresses of currently joined rooms.
*/
private final Set<EntityBareJid> joinedRooms = new CopyOnWriteArraySet<>();
/**
* A Map of MUC JIDs to {@link MultiUserChat} instances. We use weak references for the values in order to allow