diff --git a/source/net/yacy/cora/protocol/ConnectionInfo.java b/source/net/yacy/cora/protocol/ConnectionInfo.java index cb1a87a4b..0e4af1e50 100644 --- a/source/net/yacy/cora/protocol/ConnectionInfo.java +++ b/source/net/yacy/cora/protocol/ConnectionInfo.java @@ -289,16 +289,17 @@ public class ConnectionInfo implements Comparable { * removes stale connections */ public static void cleanUp() { - cleanup(getAllConnections().iterator()); - cleanup(getServerConnections().iterator()); + cleanup(getAllConnections()); + cleanup(getServerConnections()); } - private static void cleanup(final Iterator iter) { + private static void cleanup(final Set connectionSet) { + final Iterator iter = connectionSet.iterator(); synchronized (iter) { while (iter.hasNext()) try { ConnectionInfo con = iter.next(); if(con.getLifetime() > staleAfterMillis) { - getAllConnections().remove(con); + connectionSet.remove(con); } } catch (ConcurrentModificationException e) {} }