commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abhijit Akhawe" <abhi.akh...@gmail.com>
Subject Re: pool - cleaning up resources on JVM exit
Date Fri, 30 Mar 2007 19:10:39 GMT
Not sure if finalizers will be invoked if the JVM 'crashes'. Finalizers will
work in case there is a graceful exit of JVM.

On 3/30/07, Will Pugh <willpugh@sourcelabs.com> wrote:
>
> Finalizers can be a pain, but might for this scenario they might work
> for you.
>
> Sandy McArthur wrote:
> > When the JVM crashes there is no cleaning up, the JVM just exits and
> > the OS will clean up what it can. Pool cannot recover from a JVM
> > crash.
> >
> > When the JVM exits there will be a bit more clean up. Whether or not
> > it's a full clean up or something else will depend on your use of the
> > shutdown handlers. Pool does not use shutdown handlers.
> >
> > If a borrowed object isn't returned to the pool and "lost" the JVM's
> > garbage collector should take care of it.
> > PoolableObjectFactory.destroyObject won't get a chance to clean up
> > that object.
> >
> > If you want a way to clean up after an object instance is garbage
> > collected you should look into ReferenceQueue and taking clean up
> > action when an instance is no more.
> >
> > HTH.
> >
> > On 3/30/07, Conrad CRAMPTON PSE 52704
> > <conrad.crampton@kent.pnn.police.uk> wrote:
> >> Hi,
> >> Is there anyway of clearing up resources from a GenericObjectPool when
> >> the JMV closes (crashes)? I have objects that maintain a connection to
> a
> >> service that need to be closed when the web server is restarted or
> >> crashes.
> >> Also, if an object is borrowed from the pool and isn't returned because
> >> of interruption in the web application flow or some other reason, does
> >> it get 'swept up' by the evictor thread eventually or is there some
> >> other way of returning this to the pool or simply just destroying it
> for
> >> it to be recreated in the pool when necessary?
> >>
> >> Thanks for your consideration
> >> Conrad
> >>
> >>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message