Description
When interrupt() is done for waiting thread, there is a case when InterruptedException does not
occur, but the thread wakes up.
REPRODUCE:
1) Compile the attached programs
2) Invoke java WaitTest
According to the following portion extracted from "WaitTest.java",
the program should not reached to (*) line.
--- WaitTest.java --->
....
int i = 0;
while (true) {
try {
synchronized (target) {
target.wait();
}
System.out.println("NG : " + target.isInterrupted()); <=== (*)
System.exit(255);
} catch (InterruptedException ie) {
....
<--------------------
However, actual message shows the program reaches to
(*) line.
c:\tmp> java WaitTest
.....
10590
10591
10592
NG : true
NOTE :
This behavior seems to occur only in Windows and multi processor(or Hyper threading).
This issue could not be seen in WindowsXP(single processor), Solaris9(Ultra II * 6)
and RHEL3u5(Xeon * 2)
occur, but the thread wakes up.
REPRODUCE:
1) Compile the attached programs
2) Invoke java WaitTest
According to the following portion extracted from "WaitTest.java",
the program should not reached to (*) line.
--- WaitTest.java --->
....
int i = 0;
while (true) {
try {
synchronized (target) {
target.wait();
}
System.out.println("NG : " + target.isInterrupted()); <=== (*)
System.exit(255);
} catch (InterruptedException ie) {
....
<--------------------
However, actual message shows the program reaches to
(*) line.
c:\tmp> java WaitTest
.....
10590
10591
10592
NG : true
NOTE :
This behavior seems to occur only in Windows and multi processor(or Hyper threading).
This issue could not be seen in WindowsXP(single processor), Solaris9(Ultra II * 6)
and RHEL3u5(Xeon * 2)
Attachments
Issue Links
- duplicates
-
JDK-6344935 (spec) clarify specifications for Object.wait overloads
- Closed