in the following code, e.printStackTrace() does nothing on Solaris but it works on Windows XP.
class Death {
public static void main(String[] args) throws Throwable{
Thread t = new Thread() {
public void run() {
try {
while(true);
}catch(ThreadDeath e) {
e.printStackTrace();
System.out.println(e);
throw e;
}finally {
System.out.println("finally reached");
}
}
};
t.start();
Thread.sleep(2000);
System.out.println("state " + t.getState() + "\tisAlive " + t.isAlive());
t.stop();
System.out.println("state " + t.getState() + "\tisAlive " + t.isAlive());
Thread.sleep(2000);
System.out.println("2sec later state " + t.getState() + "\tisAlive " + t.isAlive());
}
}
###@###.### 2005-07-13 04:28:52 GMT
class Death {
public static void main(String[] args) throws Throwable{
Thread t = new Thread() {
public void run() {
try {
while(true);
}catch(ThreadDeath e) {
e.printStackTrace();
System.out.println(e);
throw e;
}finally {
System.out.println("finally reached");
}
}
};
t.start();
Thread.sleep(2000);
System.out.println("state " + t.getState() + "\tisAlive " + t.isAlive());
t.stop();
System.out.println("state " + t.getState() + "\tisAlive " + t.isAlive());
Thread.sleep(2000);
System.out.println("2sec later state " + t.getState() + "\tisAlive " + t.isAlive());
}
}
###@###.### 2005-07-13 04:28:52 GMT
- duplicates
-
JDK-4329256 interrupted thread no longer produces output (sol)
- Closed
- relates to
-
JDK-4385444 (spec) InterruptedIOException should not be required by platform specification (sol)
- Closed
-
JDK-6194515 Thread.isInterrupted() returns true for stopped threads
- Closed