I have an app that uses commons pool (Keyed Pool) to efficient keep various instances of a heavyweight class in memory (duh). That works great.
I know believe that the heavyweight class I'm using is now thread-safe, so I was thinking that if there was a pool implementation that only created one instance (per key) and then would dispose it when it was never used again, I could swap in that pool implementation and do threadsafe testing without much code rewrite.
Is there such a trivial pool impl available, or does anybody have clever suggestions for how to do this? I figure I could manually go through and write a keyed pool impl to do this, but the trick is I do want it to eventually reap pool instances for keys that are never used... I just no longer want it to create multiple instances for an individual key.
Any tricks would be greatly appreciated.
If you need only one object at any point in time I suggest to use a SingleTon pattern.
If the object it never used it will not be instantiated.
If the object is used it will be reused between clients.
Poooling a single object looks overkill to me.
-- John Zoetebier Web site: http://www.transparent.co.nz
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
