prevention of possible ConcurrentModificationException

This happend at my peer and created a deadlock.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2179 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 71228cfc56
commit 2185a5cfb7

@ -108,12 +108,14 @@ public final class indexTreeMapContainer extends indexAbstractContainer implemen
// returns the number of new elements
long startTime = System.currentTimeMillis();
if (c == null) return 0;
Iterator i = c.entries();
int x = 0;
while ((i.hasNext()) && ((maxTime < 0) || ((startTime + maxTime) > System.currentTimeMillis()))) {
try {
if (addi((indexURLEntry) i.next())) x++;
} catch (ConcurrentModificationException e) {}
synchronized (c) {
Iterator i = c.entries();
while ((i.hasNext()) && ((maxTime < 0) || ((startTime + maxTime) > System.currentTimeMillis()))) {
try {
if (addi((indexURLEntry) i.next())) x++;
} catch (ConcurrentModificationException e) {}
}
}
this.updateTime = java.lang.Math.max(this.updateTime, c.updated());
return x;

Loading…
Cancel
Save