Skip to content

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

added more interruptions in DidYouMean because that was the cause for some blockings during search

Michael Peter Christen125d47b3c178
diff --git a/source/de/anomic/data/DidYouMean.java b/source/de/anomic/data/DidYouMean.java
index a15b1c339..a3331014e 100644
--- a/source/de/anomic/data/DidYouMean.java
+++ b/source/de/anomic/data/DidYouMean.java
@@ -275,7 +275,9 @@ public class DidYouMean {
// we take guessLib entries as long as there is any entry in it
// to see if this is the case, we must wait for termination of the producer
for (final Thread t: producers) {
- try { t.join(); } catch (final InterruptedException e) {}
+ if (this.timeLimit > System.currentTimeMillis()) try {
+ t.join(Math.max(0, this.timeLimit - System.currentTimeMillis()));
+ } catch (final InterruptedException e) {}
}
// if there is not any entry in guessLib, then transfer all entries from the
@@ -297,7 +299,9 @@ public class DidYouMean {
// wait for termination of consumer
for (final Consumer c: consumers) {
- try { c.join(); } catch (final InterruptedException e) {}
+ if (this.timeLimit > System.currentTimeMillis()) try {
+ c.join(Math.max(0, this.timeLimit - System.currentTimeMillis()));
+ } catch (final InterruptedException e) {}
}
// we don't want the given word in the result