Article View: borland.public.jbuilder.linux
Article #4933Re: Problem with AWT...
From: John P. McGrath
Date: Wed, 01 Dec 1999 00:00
Date: Wed, 01 Dec 1999 00:00
57 lines
2158 bytes
2158 bytes
On Mon, 29 Nov 1999 12:12:10 +0100, tluyben wrote:
> > Calling System.exit() will stop the program.
>
> Which will also result in terminating my servletrunner (jws for instance).
> So this is not a good solution...
You could also hunt down the threads and do a thread.stop() on them.
I am curious -- Why are you using a Toolkit from a servlet?
--
John P. McGrath
<JPMcGrath@fast.net>
<jpm@nscs.fast.net>
> "John P. McGrath" wrote:
>
> > On Wed, 24 Nov 1999 23:12:32 +0100, tluyben wrote:
> >
> > > The following piece of code NEVER ends...
> > > I'm running this from a servlet and because 3 AWT
> > > threads in the VM never end, my memory gets sucked
> > > up.
> >
> > > import java.awt.*;
> > > public class ThreadsAreStuck {
> > > public static void main(String args[]) {
> > > Toolkit.getDefaultToolkit();
> > > }
> > > }
> >
> > I think what is happening is that Toolkit.getDefaultToolkit() initializes
> > the AWT, which causes several non-daemon threads to be created. Since
> > the threads are still active, the program does not end when the program
> > drops off the end of the main() method.
> >
> > This is exactly the same situation you will see if you display a frame
> > and then later close it. The AWT threads are still running, so the
> > program continues.
> >
> > Calling System.exit() will stop the program.
> >
>
> Which will also result in terminating my servletrunner (jws for instance).
> So this is not a good solution...
>
> Thanks anyway!
>
> >
> > --
> > John P. McGrath
> > <JPMcGrath@fast.net>
> > <jpm@nscs.fast.net>
>
>
Technical Details
Message-ID:
<MPG.12ae84e56cc197f99896db@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<383C62D0.4D2CEAB8@a-net.nl> <MPG.12abe73cd24597eb9896ce@forums.borland.com> <38425F8A.B5F8A2B6@a-net.nl>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 107590,f75020f1ffc57019 X-Google-Attributes: gid107590,public From: John P. McGrath <mcgrath@enter.net> Subject: Re: Problem with AWT... Date: 1999/12/01 Message-ID: <MPG.12ae84e56cc197f99896db@forums.borland.com> X-Deja-AN: 555171608 References: <383C62D0.4D2CEAB8@a-net.nl> <MPG.12abe73cd24597eb9896ce@forums.borland.com> <38425F8A.B5F8A2B6@a-net.nl> Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.linux