On 7/19/07, Nicholas Hemley [EMAIL PROTECTED] wrote:
Hello,
I am using the commons pool for a project and would like only one object
instance to be stored per key using the GenericKeyedObjectPool - is this
actually possible?
No, not directly.
The javadoc for KeyedObjectPool states that:
One more note on this. GenericKeyedObjectPool does allow you to limit
the number of *active* instances per key, using setMaxActive(key). If
you want to allow one or more to be active, but just to limit the
number cached in the pool (numIdle) to 1 per key, this is not possible
directly and you
Phil,
many thanks for your reply on this - basically, i am now using the setMaxActive
to set the active instances to one per key, which does what i want it to do,
but i also have a cache wrapping the pool to keep a track of the active objects
and then deliver the same object when requested by