RE: Shtting down classes when tomcat shuts down.

2002-12-16 Thread Shapira, Yoav
Hi,

>Hello. I have some classes that are started by a servlet when tomcat
>starts, their main method has a timer to execute some stuff
periodically. >When I shut tomcat down, the classes remain running.  How
can i make them >shut down with tomcat?

One possible way would be to implement a ServletContextListener and its
contextDestroyed() event, shut down the classes gracefully.

Another way, assuming the classes are extensions of threads, to mark
them as daemons.  Daemon threads will die when tomcat exits.

Did you write these classes or are they 3rd party?

>The reason they stay up is probabbly the same for their log file to be
>catalina's log and not my app's log, which i still have not figured out
how
>to change.

I doubt that's the reason they stay up.  It's more likely that the above
are two separate issues.  You could post another question in a new
thread with logging questions.  I suggest you search the archives first
as the above question is fairly common.

Yoav Shapira
Millennium ChemInformatics

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Shtting down classes when tomcat shuts down.

2002-12-16 Thread Alexander Wallace
Thankyou, i'll see into that. I did writhe the classes so i can change them.  

About the logging, well, i did post a message here, i don't thing i found out 
what i was hoping (using System.out.println(), if the classes are not 
servlets, the log goes to catalina and not my app).

Anyways, i can live with that, but i'll probably use the   
ServletContextListener to solve the problem with the classes not shutting 
down.

Again thanks!

On Monday 16 December 2002 15:49, Shapira, Yoav wrote:
> Hi,
>
> >Hello. I have some classes that are started by a servlet when tomcat
> >starts, their main method has a timer to execute some stuff
>
> periodically. >When I shut tomcat down, the classes remain running.  How
> can i make them >shut down with tomcat?
>
> One possible way would be to implement a ServletContextListener and its
> contextDestroyed() event, shut down the classes gracefully.
>
> Another way, assuming the classes are extensions of threads, to mark
> them as daemons.  Daemon threads will die when tomcat exits.
>
> Did you write these classes or are they 3rd party?
>
> >The reason they stay up is probabbly the same for their log file to be
> >catalina's log and not my app's log, which i still have not figured out
>
> how
>
> >to change.
>
> I doubt that's the reason they stay up.  It's more likely that the above
> are two separate issues.  You could post another question in a new
> thread with logging questions.  I suggest you search the archives first
> as the above question is fairly common.
>
> Yoav Shapira
> Millennium ChemInformatics
>
> --
> To unsubscribe, e-mail:  
>  For additional
> commands, e-mail: 


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Shtting down classes when tomcat shuts down.

2002-12-16 Thread Tim Funk
If you are launching background threads make sure either:
- The threads are background threads
or
- The threads get "killed" on shutdown

If tomcat shuts itself down - the JVM it is running in will run until 
there are NO non-daemon threads running.

-Tim


Alexander Wallace wrote:
Hello. I have some classes that are started by a servlet when tomcat starts, 
their main method has a timer to execute some stuff periodically. When i shut 
tomcat down, the classes remain running.  How can i make them shut down with 
tomcat? 

The reason they stay up is probabbly the same for their log file to be 
catalina's log and not my app's log, which i still have not figured out how 
to change.

Thanks!




--
To unsubscribe, e-mail:   
For additional commands, e-mail: