tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JensStu...@quidinfo.it
Subject Re: Running class finalize method when stopping/restarting a WebApp
Date Mon, 14 Oct 2002 14:40:22 GMT

There is no way to ensure, that a finalize method is called. It depends on
the JVM's GC implementation and has nothing to do with tomcat. If it's a
servlet, you can override the destroy() method of the servlet class to
close your connections. Or you make a class that implements
HttpSessionBindingListener and put it into the session (depends on your
connection architecture).

Regards,

Jens Stutte



                                                                                         
                  
                    Oakleaf Admin                                                        
                  
                    <Admin@oakleafconsul        To:     "'tomcat-user@jakarta.apache.org'"
                 
                    tancy.com>                  <tomcat-user@jakarta.apache.org>
                           
                                                cc:                                      
                  
                    27/09/2002 15.20            Subject:     Running class finalize method
when             
                    Please respond to           stopping/restarting a WebApp             
                  
                    "Tomcat Users List"                                                  
                  
                                                                                         
                  
                                                                                         
                  




Hi,

I have an application scope class that is managing an Oracle connection
cache to my database.

The finalize method of this class is written to terminate all connections
and close the connection cache.

However, when I stop the webapp or restart it (using the manager app) the
finalize of this class is not run everytime (about1 in every 3 times it
does
run), furthermore it seems to me that Tomcat is keeping a reference to the
class as the garbage collector never closes it and Oracle DCD cannot
terminate the connection as it thinks it is still alive.

Can anyone tell me how to ensure the finalize method is run everytime the
webapp is stopped/restarted or if there is any other way of doing the same
thing ?

Thanks in advance, Eddie






--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message