commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Räss" <co...@gmx.ch>
Subject [pool] evicting idle instances
Date Wed, 18 Apr 2007 15:57:09 GMT
Hi

I'm using the current HEAD of commons-pool. I've had a look at the new composite classes,
which look quite promising. 

I want to limit the total number of idle objects when using a KeyedObjectPool. I'd like to
release objects using a (global) LRU algorithm. As far as I've seen, it is only possible to
limit the idle objects per ObjectPool (using FactoryConfig.setMaxIdle, which causes an IdleLimitManager
to be created). However, the Manager (as well as the Lender) object seems to be created per
ObjectPool. Is it possible with the current design to remove the least recently used idle
object from the keyed pool (irrespective of its kind)? Any implementation hints? 

An example (max keyed pool idle instances = 5; keys a and b):

a -> [1,2,3]
b -> [4,5]

The access order (LRU) is: [5,4,3,2,1]

Next, an object for key c is requested from the pool. The access order list is now: [6,5,4,3,2,1],
which is too large. The object 1 is removed, resulting in the following access order list:
[6,5,4,3,2]. Object 1 has to be removed from the object pool of key a too. When an object
is returned to the pool, it is inserted at the beginning of the access order list. Thus, objects
that are used often will not get evicted. 

Thanks
Simon

-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message