fix for ConnectionInfo.cleanup of server-connections

pull/1/head
sixcooler 10 years ago
parent 6f707b4305
commit eb9d2705d2

@ -289,16 +289,17 @@ public class ConnectionInfo implements Comparable<ConnectionInfo> {
* removes stale connections
*/
public static void cleanUp() {
cleanup(getAllConnections().iterator());
cleanup(getServerConnections().iterator());
cleanup(getAllConnections());
cleanup(getServerConnections());
}
private static void cleanup(final Iterator<ConnectionInfo> iter) {
private static void cleanup(final Set<ConnectionInfo> connectionSet) {
final Iterator<ConnectionInfo> 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) {}
}

Loading…
Cancel
Save