Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
Name: el35337 Date: 06/04/98 // // In the documentation of Thread.stop(), it states: // // "It is permitted to stop a thread that has not yet been started. // If the thread is eventually started, it immediately terminates." // // // The following code demonstrates that this specification is not implemented. // The thread t1 is stopped, then started. It executes to completion and is not // "terminated immediately", as per the API documentation. // // To compile: javac Bug1.java // To execute: java -classpath .;%CLASSPATH% Bug1 // public class Bug1 { static public class SomeRunnable implements Runnable { public void run() { try { System.err.println("run() sleep(5000) begins in" + Thread.currentThread().getName()); Thread.sleep(5000); System.err.println("run() exits in" + Thread.currentThread().getName()); } catch (InterruptedException e) { } } } public static void main(String args[]) { Thread t1; t1 = new Thread(new SomeRunnable()); t1.stop(); t1.start(); } } (Review ID: 32949) ======================================================================