mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 20:12:07 +01:00
Use CopyOnWriteArraySet for connectionListener
This commit is contained in:
parent
6dcba44557
commit
03686fbaaf
1 changed files with 5 additions and 5 deletions
|
@ -22,9 +22,11 @@ import java.io.Writer;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
|
@ -93,8 +95,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* A collection of ConnectionListeners which listen for connection closing
|
* A collection of ConnectionListeners which listen for connection closing
|
||||||
* and reconnection events.
|
* and reconnection events.
|
||||||
*/
|
*/
|
||||||
protected final Collection<ConnectionListener> connectionListeners =
|
protected final Set<ConnectionListener> connectionListeners =
|
||||||
new CopyOnWriteArrayList<ConnectionListener>();
|
new CopyOnWriteArraySet<ConnectionListener>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A collection of PacketCollectors which collects packets for a specified filter
|
* A collection of PacketCollectors which collects packets for a specified filter
|
||||||
|
@ -609,9 +611,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
if (connectionListener == null) {
|
if (connectionListener == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!connectionListeners.contains(connectionListener)) {
|
connectionListeners.add(connectionListener);
|
||||||
connectionListeners.add(connectionListener);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue