mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-24 03:27:59 +01:00
Use CopyOnWriteArraySet for pingFailedListeners
To prevent java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:788) at java.util.HashMap$KeyIterator.next(HashMap.java:815) at org.jivesoftware.smackx.ping.PingManager.pingMyServer(PingManager.java:252) at org.kontalk.service.msgcenter.MessageCenterService$3.run(MessageCenterService.java:1114) at java.lang.Thread.run(Thread.java:818) Thanks to Daniele Ricci for reporting this.
This commit is contained in:
parent
bb3eeb9af0
commit
6cfdf2bc6f
1 changed files with 3 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2012-2015 Florian Schmaus
|
||||
* Copyright 2012-2017 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -16,11 +16,10 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.ping;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
@ -105,8 +104,7 @@ public final class PingManager extends Manager {
|
|||
defaultPingInterval = interval;
|
||||
}
|
||||
|
||||
private final Set<PingFailedListener> pingFailedListeners = Collections
|
||||
.synchronizedSet(new HashSet<PingFailedListener>());
|
||||
private final Set<PingFailedListener> pingFailedListeners = new CopyOnWriteArraySet<>();
|
||||
|
||||
private final ScheduledExecutorService executorService;
|
||||
|
||||
|
|
Loading…
Reference in a new issue