Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
Removing unnecessary and possibly dangerous synchronization of the wordIndex when deleting transferred indexes
hermens0cfba8950f86
diff --git a/source/de/anomic/plasma/plasmaDHTChunk.java b/source/de/anomic/plasma/plasmaDHTChunk.javaindex 7498cd86f..61154e205 100644--- a/source/de/anomic/plasma/plasmaDHTChunk.java+++ b/source/de/anomic/plasma/plasmaDHTChunk.java@@ -261,20 +261,18 @@ public class plasmaDHTChunk {plasmaWordIndexEntry indexEntry;String[] urlHashes;int count = 0;- synchronized (wordIndex) {- for (int i = 0; i < this.indexContainers.length; i++) {- // delete entries separately- int c = 0;- urlHashes = new String[this.indexContainers[i].size()];- urlIter = this.indexContainers[i].entries();- while (urlIter.hasNext()) {- indexEntry = (plasmaWordIndexEntry) urlIter.next();- urlHashes[c++] = indexEntry.getUrlHash();- }- count += wordIndex.removeEntries(this.indexContainers[i].wordHash(), urlHashes, true);- log.logFine("Deleted partial index (" + c + " URLs) for word " + this.indexContainers[i].wordHash() + "; " + this.wordIndex.indexSize(indexContainers[i].wordHash()) + " entries left");- this.indexContainers[i] = null;+ for (int i = 0; i < this.indexContainers.length; i++) {+ // delete entries separately+ int c = 0;+ urlHashes = new String[this.indexContainers[i].size()];+ urlIter = this.indexContainers[i].entries();+ while (urlIter.hasNext()) {+ indexEntry = (plasmaWordIndexEntry) urlIter.next();+ urlHashes[c++] = indexEntry.getUrlHash();}+ count += wordIndex.removeEntries(this.indexContainers[i].wordHash(), urlHashes, true);+ log.logFine("Deleted partial index (" + c + " URLs) for word " + this.indexContainers[i].wordHash() + "; " + this.wordIndex.indexSize(indexContainers[i].wordHash()) + " entries left");+ this.indexContainers[i] = null;}return count;}