avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Berin Loritsch" <blorit...@apache.org>
Subject RE: [RT] pooling vs. release
Date Thu, 01 Aug 2002 15:11:55 GMT


> -----Original Message-----
> From: Peter Royal [mailto:proyal@apache.org] 
> Sent: Thursday, August 01, 2002 10:47 AM
> To: Avalon Developers List
> Subject: Re: [RT] pooling vs. release
> 
> 
> On Thursday 01 August 2002 10:45 am, Torsten Curdt wrote:
> > There are several problems:
> >
> > 1) finalize will only be triggered by the gc. so the 
> components will 
> > locked much longer than doing a straight release. (does 
> this kind of 
> > pooling still make sense?)
> 
> I think you found the problem right there. If you are pooling 
> a limited 
> resource, say JDBC connections, you don't want to have to 
> wait for the gc to 
> kick in before you can get that connection back from the pool.
> 
> If we had deterministic gc, I think it might have a better 
> chance of being 


Also the pool would have to use weak references--or it will never
get GC'd (a strong reference will exist in the pool--so the GC will
never collect the pooled object).

I think that it is also inherently flawed because once the finalize()
method is called, the object is slated for removal--so there is no
guarantee it will be there to reinsert into a pool.  Also, a poorly
implemented JVM might throw a memory protection exception trying to
access an object that no longer exists in memory...


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


Mime
View raw message