LUCENE-2813: only throw the mock failure into the main thread

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1045310 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2010-12-13 19:05:23 +00:00
parent 34a6968476
commit 64e19107d9
1 changed files with 6 additions and 0 deletions

View File

@ -625,14 +625,20 @@ public class TestIndexWriterDelete extends LuceneTestCase {
MockDirectoryWrapper.Failure failure = new MockDirectoryWrapper.Failure() {
boolean sawMaybe = false;
boolean failed = false;
Thread thread;
@Override
public MockDirectoryWrapper.Failure reset() {
thread = Thread.currentThread();
sawMaybe = false;
failed = false;
return this;
}
@Override
public void eval(MockDirectoryWrapper dir) throws IOException {
if (Thread.currentThread() != thread) {
// don't fail during merging
return;
}
if (sawMaybe && !failed) {
boolean seen = false;
StackTraceElement[] trace = new Exception().getStackTrace();