Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
DidYouMean: as I moved to only 8 consumer and 4 producer threads, I removed poison pills as it does not make sense anymore - threads are interrupted directly. Having a consumer thread per test case just didn't make sense either (see svn 6070) due to the massive overhead.
apfelmaennchen39779e479669
diff --git a/source/de/anomic/tools/DidYouMean.java b/source/de/anomic/tools/DidYouMean.javaindex 72dff5a8c..8bb7afffc 100644--- a/source/de/anomic/tools/DidYouMean.java+++ b/source/de/anomic/tools/DidYouMean.java@@ -63,17 +63,31 @@ public class DidYouMean {}// check if timeout has been reached- while(((System.currentTimeMillis()-startTime) < TIMEOUT) && queue.size()>0) {- // consume more ...+ boolean cont = false;+ while(((System.currentTimeMillis()-startTime) < TIMEOUT)) {+ if(queue.size()==0) {+ // check if at least one producers is still running+ for (int i=0; i<producers.length; i++) {+ if(producers[i].isAlive())+ cont = true;+ }+ if(!cont) break;+ }}- // put "poison pill" for each consumer thread+ // interupt all consumer threads+ for (int i=0; i<consumers.length; i++) {+ consumers[i].interrupt();+ }++ /* put "poison pill" for each consumer threadfor (int i=0; i<consumers.length; i++) {try {queue.put("\n");} catch (InterruptedException e) {}}+ */// interupt all remaining producer threadsfor (int i=0; i<producers.length; i++) {@@ -82,7 +96,7 @@ public class DidYouMean {this.set.remove(word.toLowerCase());Log.logInfo("DidYouMean", "found "+this.set.size()+" terms; execution time: "- +(System.currentTimeMillis()-startTime)+"ms"+ (queue.size()>0?"(timed out)":""));+ +(System.currentTimeMillis()-startTime)+"ms"+ " - remaining queue size: "+queue.size());return this.set;