Skip to content

Commit

Permalink
catched ConcurrentModificationException in ConnectionInfo.cleanUp so …
Browse files Browse the repository at this point in the history
…cleanUp is not interrupted

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4692 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
danielr committed Apr 14, 2008
1 parent 70826bb commit 64c33e7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions source/de/anomic/http/HttpConnectionInfo.java
Expand Up @@ -30,6 +30,8 @@
import java.util.HashSet;
import java.util.Set;

import de.anomic.server.logging.serverLog;

/**
* Information about a connection
*
Expand Down Expand Up @@ -152,12 +154,16 @@ public static void removeConnection(final int id) {
* removes stale connections
*/
public static void cleanUp() {
synchronized (allConnections) {
for(HttpConnectionInfo con: allConnections) {
if(con.getLifetime() > staleAfterMillis) {
allConnections.remove(con);
try {
synchronized (allConnections) {
for(HttpConnectionInfo con: allConnections) {
if(con.getLifetime() > staleAfterMillis) {
allConnections.remove(con);
}
}
}
} catch (java.util.ConcurrentModificationException e) {
serverLog.logWarning("HTTPC", "cleanUp ConnectionInfo interrupted by ConcurrentModificationException");
}
}

Expand Down

0 comments on commit 64c33e7

Please sign in to comment.