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

(spec thread) Thread.stop() works differently from what API document says

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      A licensee reports the thread.stop() behavior does not follow the specifications
      in thread.stop() API Document(although stop() is deprecated....)

      According to the API document of thread.stop(),

      .....
      It is permitted to stop a thread that has not yet been started. If the thread is eventually started, it immediately terminates.
      ....

      They hoped "when stopped thread starts , the thread terminates without doing anything."
      However, they found the following test case.

      --- Test Case ---->

      public class ThreadDeathBeforeStart extends Thread{
         public static void main(String[] args) throws Exception {
            Thread t = new ThreadDeathBeforeStart();
             t.stop();
             t.start();
      }

      public void run() {
         System.out.println("aaa");
      }

      <--- Test Case End -----

      The test case outputs "aaa". That does not seem to represent what API documents says.

      Ex. )

      K:\shares2\thread-stop-behavior-strange>java -showversion ThreadDeathBeforeStart
      java version "1.6.0-ea"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b11)
      Java HotSpot(TM) Client VM (build 1.6.0-ea-b11, mixed mode)

      aaa

      K:\shares2\thread-stop-behavior-strange>

      CONFIGURATION :
        OS : WindowsXP(SP1, Japanese)
        JRE : 1.4.2/5.0/6.0b11

      ###@###.### 2004-11-15 07:37:57 GMT

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              psoper Pete Soper (Inactive)
              Reporter:
              tbaba Tadayuki Baba (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: