-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
5.0u9
-
sparc
-
solaris_2.5.1
Problem :
System.out.flush() sets the thread's interrupted status flag from true to false on Solaris.
Other io methods like println() do not change threads interrupted status.
Test Case:
public class InterruptTest extends Thread {
public InterruptTest() {
}
public void run() {
System.out.println("The interrupt flag is initially " +
this.isInterrupted() );
System.out.println("Setting the interrupt flag to true.");
this.interrupt();
System.out.println("The interrupt flag is now " +
this.isInterrupted() );
System.out.flush();
if (this.isInterrupted() == false) {
System.out.println("ERROR: After calling flush(), the
interrupt " +
"flag is now false, but is should be true.");
}
else {
System.out.println("After calling flush(), the interrupt
flag " +
" is still true, which is the correct
result.");
}
}
public static void main(String[] args) {
InterruptTest test = new InterruptTest();
test.start();
try {
test.join();
}
catch (InterruptedException e) {
System.err.println("ERROR: InterruptTest interrupted during
join");
}
}
}
O/P on Windows :
The interrupt flag is initially false
Setting the interrupt flag to true.
The interrupt flag is now true
After calling flush(), the interrupt flag is still true, which is the correct result.
O/P on Solaris :
The interrupt flag is initially false
Setting the interrupt flag to true.
The interrupt flag is now true
ERROR: After calling flush(), the interrupt flag is now false, but is should be true.
Is this inconsistent behaviour intended?
System.out.flush() sets the thread's interrupted status flag from true to false on Solaris.
Other io methods like println() do not change threads interrupted status.
Test Case:
public class InterruptTest extends Thread {
public InterruptTest() {
}
public void run() {
System.out.println("The interrupt flag is initially " +
this.isInterrupted() );
System.out.println("Setting the interrupt flag to true.");
this.interrupt();
System.out.println("The interrupt flag is now " +
this.isInterrupted() );
System.out.flush();
if (this.isInterrupted() == false) {
System.out.println("ERROR: After calling flush(), the
interrupt " +
"flag is now false, but is should be true.");
}
else {
System.out.println("After calling flush(), the interrupt
flag " +
" is still true, which is the correct
result.");
}
}
public static void main(String[] args) {
InterruptTest test = new InterruptTest();
test.start();
try {
test.join();
}
catch (InterruptedException e) {
System.err.println("ERROR: InterruptTest interrupted during
join");
}
}
}
O/P on Windows :
The interrupt flag is initially false
Setting the interrupt flag to true.
The interrupt flag is now true
After calling flush(), the interrupt flag is still true, which is the correct result.
O/P on Solaris :
The interrupt flag is initially false
Setting the interrupt flag to true.
The interrupt flag is now true
ERROR: After calling flush(), the interrupt flag is now false, but is should be true.
Is this inconsistent behaviour intended?
- duplicates
-
JDK-6382902 VM interrupted I/O feature put on an option switch (sol)
- Closed
- relates to
-
JDK-4385444 (spec) InterruptedIOException should not be required by platform specification (sol)
- Closed