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

runnung thread is not alive after stop()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.1.8
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5.1

      Description

      Method Thread.stop() does not nesessary stops a thread but only causes
      an exception to be thrown on this thread. This exception can be intercepted
      and the thread can cantinue executionm

      However, in all jdk1.1.* releases, Thread.stop() immediately marks the object
      thread as not alive. Thread.stop(Throwable) does it too.

      Testcase:

      import java.io.PrintStream;

      class DeadOrAliveE extends Error {}

      public class DeadOrAlive {
        static PrintStream out=System.out;
        
        public static void main(String args[]) {

      Thread me=Thread.currentThread();

      try {
      // me.stop(new DeadOrAliveE());
      me.stop();
      // } catch (DeadOrAliveE e) {
      } catch (ThreadDeath e) {
      if (me.isAlive()) {
      out.println("OK");
      } else {
      out.println("isAlive()==false for running thread");
      }
      return;
      } catch (Throwable e) {
      out.println("wrong Throwable:"+e);
      }

      out.println("no Throwable thrown after stop");
        }

      }

      % javac DeadOrAlive.java
      % java -fullversion
      java full version "JDK1.1.8M"
      % java DeadOrAlive
      isAlive()==false for running thread

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jjb Josh Bloch
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: