Playing with Thread.interrupt is real fun. Sometimes if you call Thread.interrupt on another thread which is in wait() you get InterruptedException and sometimes not, the and then you can get Thread.interrupted() to return true. Fixing the test to expect both situations. javawssupport-base
authorjtulach@netbeans.org
Fri, 22 Jul 2005 09:42:22 +0000
changeset 49ed504fad51bf
parent 48 e80bcdb0d12a
child 50 7a74b3c8477e
Playing with Thread.interrupt is real fun. Sometimes if you call Thread.interrupt on another thread which is in wait() you get InterruptedException and sometimes not, the and then you can get Thread.interrupted() to return true. Fixing the test to expect both situations.
openide.util/test/unit/src/org/openide/util/RequestProcessorTest.java
     1.1 --- a/openide.util/test/unit/src/org/openide/util/RequestProcessorTest.java	Fri Jul 22 09:27:54 2005 +0000
     1.2 +++ b/openide.util/test/unit/src/org/openide/util/RequestProcessorTest.java	Fri Jul 22 09:42:22 2005 +0000
     1.3 @@ -735,11 +735,12 @@
     1.4                  try {
     1.5                      wait ();
     1.6                      log.log("in runnable " + name + " after second wait, not interrupted");
     1.7 +                    checkAfter = Thread.interrupted();
     1.8                  } catch (InterruptedException ex) {
     1.9                      log.log("in runnable " + name + " after second wait, interrupted");
    1.10 +                    checkAfter = true;
    1.11                  }
    1.12                  
    1.13 -                checkAfter = Thread.interrupted();
    1.14                  log.log("in runnable " + name + " checkAfter: " + checkAfter);
    1.15                  
    1.16                  notifyAll ();