Article View: borland.public.jbuilder.linux
Article #4934Re: Problem with AWT...
From: tluyben
Date: Wed, 01 Dec 1999 00:00
Date: Wed, 01 Dec 1999 00:00
79 lines
3278 bytes
3278 bytes
"John P. McGrath" wrote:
> 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 did, it is not working. These are native threads and they cannot be stopped (
if you can, please tell me how ;-)
>
> I am curious -- Why are you using a Toolkit from a servlet?
>
I need to load gif and jpg images and createImage with arrays. I need Toolkit
for this. I have an example on the web where they created a counter with a
servlet.
This thing also never ends; I mailed them, and they never noticed. Except that
NT got slower and slower until they had to restart. They thought this was a Win
problem (I thought so until we moved to Linux and Solaris). Under Unix the
servletrunner keeps going, gobbling up more resources while running. It never
crashes, but it makes the system unusable by taking 20 mb mem with every 4
threads
spawned, so in the end the system is unusable.
If you know a way out of using Toolkit then this would be cool!
>
> --
> 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:
<38454CF8.2A61206C@a-net.nl>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<383C62D0.4D2CEAB8@a-net.nl> <MPG.12abe73cd24597eb9896ce@forums.borland.com> <38425F8A.B5F8A2B6@a-net.nl> <MPG.12ae84e56cc197f99896db@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 107590,f75020f1ffc57019 X-Google-Attributes: gid107590,public From: tluyben <tycho@a-net.nl> Subject: Re: Problem with AWT... Date: 1999/12/01 Message-ID: <38454CF8.2A61206C@a-net.nl> X-Deja-AN: 555345179 Content-Transfer-Encoding: 7bit References: <383C62D0.4D2CEAB8@a-net.nl> <MPG.12abe73cd24597eb9896ce@forums.borland.com> <38425F8A.B5F8A2B6@a-net.nl> <MPG.12ae84e56cc197f99896db@forums.borland.com> To: "John P. McGrath" <mcgrath@enter.net> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.linux