|
Duplicate :
|
|
|
Relates :
|
|
|
Relates :
|
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
|