JDK-4145906 : Thread.stop() not implemented according to documentation
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.1.5,1.1.6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic,windows_nt
  • CPU: generic,x86
  • Submitted: 1998-06-04
  • Updated: 1998-08-27
  • Resolved: 1998-08-27
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description

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)
======================================================================