mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02:00
Don't use synchonrizedMap() for INSTANCES
in Managers. The getInstanceFor() method is already synchronized.
This commit is contained in:
parent
6334733dae
commit
56bf54eab5
6 changed files with 12 additions and 21 deletions
|
@ -47,7 +47,6 @@ import org.jivesoftware.smackx.xdata.FormField;
|
|||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||
import org.jxmpp.util.cache.LruCache;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
|
@ -89,8 +88,7 @@ public class EntityCapsManager extends Manager {
|
|||
|
||||
private static boolean autoEnableEntityCaps = true;
|
||||
|
||||
private static Map<XMPPConnection, EntityCapsManager> instances = Collections
|
||||
.synchronizedMap(new WeakHashMap<XMPPConnection, EntityCapsManager>());
|
||||
private static Map<XMPPConnection, EntityCapsManager> instances = new WeakHashMap<>();
|
||||
|
||||
private static final PacketFilter PRESENCES_WITH_CAPS = new AndFilter(new PacketTypeFilter(Presence.class), new PacketExtensionFilter(
|
||||
ELEMENT, NAMESPACE));
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.jivesoftware.smackx.commands;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
@ -71,8 +70,7 @@ public class AdHocCommandManager extends Manager {
|
|||
* Map a XMPPConnection with it AdHocCommandManager. This map have a key-value
|
||||
* pair for every active connection.
|
||||
*/
|
||||
private static Map<XMPPConnection, AdHocCommandManager> instances =
|
||||
Collections.synchronizedMap(new WeakHashMap<XMPPConnection, AdHocCommandManager>());
|
||||
private static Map<XMPPConnection, AdHocCommandManager> instances = new WeakHashMap<>();
|
||||
|
||||
/**
|
||||
* Register the listener for all the connection creations. When a new
|
||||
|
@ -96,7 +94,10 @@ public class AdHocCommandManager extends Manager {
|
|||
*/
|
||||
public static synchronized AdHocCommandManager getAddHocCommandsManager(XMPPConnection connection) {
|
||||
AdHocCommandManager ahcm = instances.get(connection);
|
||||
if (ahcm == null) ahcm = new AdHocCommandManager(connection);
|
||||
if (ahcm == null) {
|
||||
ahcm = new AdHocCommandManager(connection);
|
||||
instances.put(connection, ahcm);
|
||||
}
|
||||
return ahcm;
|
||||
}
|
||||
|
||||
|
@ -125,9 +126,6 @@ public class AdHocCommandManager extends Manager {
|
|||
private AdHocCommandManager(XMPPConnection connection) {
|
||||
super(connection);
|
||||
this.serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection);
|
||||
|
||||
// Register the new instance and associate it with the connection
|
||||
instances.put(connection, this);
|
||||
|
||||
// Add the feature to the service discovery manage to show that this
|
||||
// connection supports the AdHoc-Commands protocol.
|
||||
|
|
|
@ -82,8 +82,7 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
|
||||
private EntityCapsManager capsManager;
|
||||
|
||||
private static Map<XMPPConnection, ServiceDiscoveryManager> instances =
|
||||
Collections.synchronizedMap(new WeakHashMap<XMPPConnection, ServiceDiscoveryManager>());
|
||||
private static Map<XMPPConnection, ServiceDiscoveryManager> instances = new WeakHashMap<>();
|
||||
|
||||
private final Set<String> features = new HashSet<String>();
|
||||
private DataForm extendedInfo = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue