Thread.stop()

Mo DeJong mdejong at cygnus.com
Mon May 22 12:31:25 PDT 2000


I also found this note in kaffe/FAQ/FAQ.pthreads

* We do not support asynchronous exceptions via Thread.stop()

Mo Dejong
Red Hat Inc.

On Mon, 22 May 2000, Mo DeJong wrote:

> I was under the impression that methods like Thread.stop() were
> removed from the JDK or replaced with no-ops. I seem to remember
> that they were never implemented in Netscape's JVM. The whole
> concept of stoping a thread seems like a bad idea, a thread
> should expire due to natural causes.
> 
> Here are some notes about it from the Sun developer site.
> http://developer.java.sun.com/developer/bugParade/bugs/4187649.html
> http://developer.java.sun.com/developer/bugParade/bugs/4248898.html
> 
> Mo Dejong
> Red Hat Inc.
> 
> On 22 May 2000, Jason Baker wrote:
> 
> > 
> > Archie Cobbs <archie at whistle.com> writes:
> > 
> > > Email me a simple test case and I'll run it under both kaffe and JDK 1.2.
> > 
> > Weird.  Blackdown 1.2.2 doesn't seem to asynchronously stop threads at
> > all, while jdk 1.1.7 can do it some of the time.  Neither one seems to
> > throw an exception with a stack trace at all.
> > 
> > Jason
> > ------------------------------------------------------------------------------
> > 1.2.2:
> > nephi(53) java Die 
> > sleeper started
> > doing it...
> > loop started
> > caught an error
> > java.lang.Error: throwing from main
> > done
> > doing it...
> > ^C
> > ------------------------------------------------------------------------------
> > 1.1.7:
> > nephi(57) java Die
> > sleeper started
> > doing it...
> > loop started
> > caught an error
> > java.lang.Error: throwing from main
> > done
> > doing it...
> > ^C
> > nephi(59) java Die 100
> > sleeper started
> > doing it...
> > loop started
> > caught an error
> > java.lang.Error: throwing from main
> > done
> > doing it...
> > caught an error
> > java.lang.Error: throwing from main
> > done
> > ------------------------------------------------------------------------------
> > patched kaffe:
> > sleeper starteddoing it...
> > 
> > loop started
> > caught an error
> > java.lang.Error: throwing from main
> >         at java.lang.Thread.waitOn(Thread.java:475)
> >         at java.lang.Thread.sleep(Thread.java:364)
> >         at Die$1.doIt(Die.java:24)
> >         at Die.run(Die.java:7)
> > done
> > doing it...
> > caught an error
> > java.lang.Error: throwing from main
> >         at Die.run(Die.java:7)
> > done
> > ------------------------------------------------------------------------------
> > public abstract class Die extends Thread {
> >   abstract void doIt();
> > 
> >   public void run()
> >   {
> >     System.err.println("doing it...");
> >     try { doIt(); }
> >     catch (Error e) {
> >       System.err.println("caught an error");
> >       e.printStackTrace(System.err);
> >     }
> >     System.err.println("done");
> >   }
> > 
> >   static public void main(String[] args)
> >     throws InterruptedException
> >   {
> >     int startup = 1000;
> >     if (args.length > 0)
> >       startup = Integer.parseInt(args[0]);
> > 
> >     Thread u = new Die() {
> >       void doIt() {
> > 	try { Thread.sleep(300000); }
> > 	catch (InterruptedException _) { }
> >       }
> >     };
> >     u.start();
> >     System.err.println("sleeper started");
> >     Thread.sleep(startup);
> >     u.stop(new Error("throwing from main"));
> > 
> >     Thread t = new Die() {
> >       void doIt() { while (true) ; }
> >     };
> >     t.start();
> >     System.err.println("loop started");
> >     Thread.sleep(startup);
> >     t.stop(new Error("throwing from main"));
> >   }
> > }
> >     
> >       
> > 
> 


More information about the kaffe mailing list