Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4145906

Thread.stop() not implemented according to documentation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.5, 1.1.6
    • core-libs
    • generic, x86
    • generic, windows_nt



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

            jjb Josh Bloch
            elarsen Erik Larsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: