1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-16 04:12:04 +01:00

Use ConcurrentHashMap instead of synchronizedMap

in ChatManager. Also use diamond operator.
This commit is contained in:
Florian Schmaus 2014-12-27 13:38:41 +01:00
parent 56bf54eab5
commit 0c68d59ade

View file

@ -18,11 +18,11 @@
package org.jivesoftware.smack; package org.jivesoftware.smack;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.CopyOnWriteArraySet;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
@ -114,17 +114,17 @@ public class ChatManager extends Manager{
/** /**
* Maps thread ID to chat. * Maps thread ID to chat.
*/ */
private Map<String, Chat> threadChats = Collections.synchronizedMap(new HashMap<String, Chat>()); private Map<String, Chat> threadChats = new ConcurrentHashMap<>();
/** /**
* Maps jids to chats * Maps jids to chats
*/ */
private Map<String, Chat> jidChats = Collections.synchronizedMap(new HashMap<String, Chat>()); private Map<String, Chat> jidChats = new ConcurrentHashMap<>();
/** /**
* Maps base jids to chats * Maps base jids to chats
*/ */
private Map<String, Chat> baseJidChats = Collections.synchronizedMap(new HashMap<String, Chat>()); private Map<String, Chat> baseJidChats = new ConcurrentHashMap<>();
private Set<ChatManagerListener> chatManagerListeners private Set<ChatManagerListener> chatManagerListeners
= new CopyOnWriteArraySet<ChatManagerListener>(); = new CopyOnWriteArraySet<ChatManagerListener>();