You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Daniel Molina (Inter-Media)" <dm...@inter-media.cl> on 2005/06/16 18:28:54 UTC
threads in tomcat
Hello,
If I use threads, through the Thread class, how can I can finish them
whenever Tomcat reloads the application that created them.
Thanks.
Regards.
Daniel Molina Wegener
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Out of memory
Posted by Christoph Kutzinski <ku...@gmx.de>.
Hi,
first: You should start a new discussion thread, if you have a new
question instead of answering to an existing one. Readers may not see
your question if you don't.
-XX:+UseAdaptiveSizePolicy works good for me (with Java 5.0). Just give
the VM a very big maximum heap size and the gc algorithm will determine
for itself how much of the memory it needs.
Here is more info:
http://java.sun.com/developer/JDCTechTips/2005/tt0216.html#2
hth,
Christoph
David Wall wrote:
> This is no doubt a java-related question, but it seems that with virtual
> memory, my JVM should never run out of memory (aside from a nasty bug
> and lack of swap disk space). Is there a way to allow my web
> application to have as much memory as the OS will give it, yet not have
> the JVM attempt to consume all that space before the GC reclaims the
> space? I'd like the JVM to start with 64M, max out around 1GB in terms
> of "holding the memory," yet allow it to use more memory when it needs
> it, and then have it attempt to release that memory so as not to cause
> swapping once the high memory need has disappeared.
>
> Can this be done?
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Out of memory
Posted by David Wall <d....@computer.org>.
This is no doubt a java-related question, but it seems that with virtual
memory, my JVM should never run out of memory (aside from a nasty bug
and lack of swap disk space). Is there a way to allow my web
application to have as much memory as the OS will give it, yet not have
the JVM attempt to consume all that space before the GC reclaims the
space? I'd like the JVM to start with 64M, max out around 1GB in terms
of "holding the memory," yet allow it to use more memory when it needs
it, and then have it attempt to release that memory so as not to cause
swapping once the high memory need has disappeared.
Can this be done?
Thanks,
David
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: threads in tomcat
Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Daniel Molina (Inter-Media)" <dm...@inter-media.cl>
> If I use threads, through the Thread class, how can I can finish them
> whenever Tomcat reloads the application that created them.
You can use a ServletContextListener which will be notified when the webapp
starts and stops. Implement the 'contextDestroyed' method, and do your
cleanup there.
--
Wendy Smoak
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: threads in tomcat
Posted by Robert Harper <ro...@iat-cti.com>.
You should hold a reference to your thread in your app. Set a flag that the
thread watches to notify it that it is time to terminate. Place this code in
the servlet's destroy() body. Calling the destroy() on the thread object is
a little drastic because it will terminate the thread without calling
cleanup methods. Thread.stop() is deprecated because it does not clean up
well either.
Robert S. Harper
Information Access Technology, Inc.
-----Original Message-----
From: Daniel Molina (Inter-Media) [mailto:dmolina@inter-media.cl]
Sent: Thursday, June 16, 2005 10:29 AM
To: Tomcat Users
Subject: threads in tomcat
Hello,
If I use threads, through the Thread class, how can I can finish them
whenever Tomcat reloads the application that created them.
Thanks.
Regards.
Daniel Molina Wegener
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org