prevent false test failure in testThreadInterruptDeadlock: force ThreadInterruptedException to be loaded up-front

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@993287 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2010-09-07 08:56:39 +00:00
parent 89c6fea889
commit 77830a0fc4
1 changed files with 6 additions and 0 deletions

View File

@ -4468,6 +4468,12 @@ public class TestIndexWriter extends LuceneTestCase {
t.setDaemon(true); t.setDaemon(true);
t.start(); t.start();
// Force class loader to load ThreadInterruptedException
// up front... else we can see a false failure if 2nd
// interrupt arrives while class loader is trying to
// init this class (in servicing a first interrupt):
assertTrue(new ThreadInterruptedException(new InterruptedException()).getCause() instanceof InterruptedException);
// issue 100 interrupts to child thread // issue 100 interrupts to child thread
int i = 0; int i = 0;
while(i < 100) { while(i < 100) {