Hi, I wonder if someone can help me or tell me if this is even possible with Commons Pool 2.
I am looking for an Object pool that has reentrant like properties, that is to say that each object in the pool would have an associated reference count, and each time `borrowObject` is called from the same thread, then the same object must be returned (and it's reference count incremented). On returning the object, the object is only really returned if it's reference count (which is decremented by the thread for each returnObject call it makes) has reached zero . It looked to me like it should not be too hard to add this either implicitly to GenericObjectPool or even explicitly to GenericKeyedObjectPool where the key is the Thread, and the pool size for each key is set to 1. I did try some local experiments, but it seems very hard to override the methods of GenericKeyedObjectPool or GenericObjectPool without being in the same package namespace :-/ Any thoughts? Has anyone done anything like this before? Cheers Adam. -- Adam Retter skype: adam.retter tweet: adamretter http://www.adamretter.org.uk --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
