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)
======================================================================
- duplicates
-
JDK-4148126 Thread.stop() doesn't prevent thread being started later
- Closed
-
JDK-4082713 stop signal issued before thread start is lost.
- Closed
- relates to
-
JDK-4519200 (thread) Started thread does not terminate immediately if it was stopped before
- Resolved
-
JDK-4216667 Thread.stop() does not always work (problem with fix for 4145910)
- Closed