join with a timeout does not cause that the corresponding thread is stopped after the time-out. It does only cause that the waiting is stopped. Here we need additionally a signal to the thread to stop after we finished waiting.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6069 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent b69f22e9ca
commit b8bb1bb364

@ -26,6 +26,7 @@ public class DidYouMean {
private final IndexCell<WordReference> index;
private String word;
private int len;
private boolean stop;
private Thread ChangingOneLetter;
private Thread AddingOneLetter;
@ -38,6 +39,7 @@ public class DidYouMean {
this.word = "";
this.len = 0;
this.index = index;
this.stop = false;
this.ChangingOneLetter = new ChangingOneLetter();
this.AddingOneLetter = new AddingOneLetter();
@ -61,6 +63,8 @@ public class DidYouMean {
this.ChangingOneLetter.join(TIMEOUT);
this.AddingOneLetter.join(TIMEOUT);
} catch (InterruptedException e) {
} finally {
stop = true;
}
this.set.remove(word.toLowerCase());
@ -82,6 +86,7 @@ public class DidYouMean {
set.add(s);
count++;
}
if (stop) return;
}
}
}
@ -98,6 +103,7 @@ public class DidYouMean {
set.add(s);
count++;
}
if (stop) return;
}
}
}
@ -114,6 +120,7 @@ public class DidYouMean {
set.add(s);
count++;
}
if (stop) return;
}
}
}
@ -130,6 +137,7 @@ public class DidYouMean {
set.add(s);
count++;
}
if (stop) return;
}
}
}

Loading…
Cancel
Save