Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

Avoid ConcurrentModificationException when accessing the PerformanceQueues page while yacy is indexing.

hermensd732840f8a4c
diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java
index b632e6969..86252ad1b 100644
--- a/source/de/anomic/plasma/plasmaWordIndex.java
+++ b/source/de/anomic/plasma/plasmaWordIndex.java
@@ -131,11 +131,13 @@ public final class plasmaWordIndex implements indexRI {
long cacheBytes = 0;
long entryBytes = indexRWIEntry.urlEntryRow.objectsize();
indexRAMRI cache = (in ? dhtInCache : dhtOutCache);
- Iterator it = cache.wordContainers(null, false);
- indexContainer ic;
- while ( it.hasNext() ) {
- ic = (indexContainer)it.next();
- cacheBytes += ic.size() * entryBytes;
+ synchronized (cache) {
+ Iterator it = cache.wordContainers(null, false);
+ indexContainer ic;
+ while ( it.hasNext() ) {
+ ic = (indexContainer)it.next();
+ cacheBytes += ic.size() * entryBytes;
+ }
}
return cacheBytes;