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

Thread.stop() not implemented according to documentation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.1.5, 1.1.6
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      generic, x86
    • OS:
      generic, windows_nt

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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: