For object pools, we say that whenever client asks for a resource, we give it from the pool. If I checked out one resource and changed its state and checked it in. What happens on the next request, does the pool let client check out this resource or this resource is invalid for the pool now?
Share
If the object released to the pool became invalid for re-use, the pool would be somewhat pointless. If a class requires initialization, or re-initialization, you could do it in the get() or release() pool methods. If reinitialization requires much more than simple assignments, (eg. a pool of socket objects that must not be re-used for 5 minutes), then you may have to resort to a dedicated pool manager thread that effectively splits the pool into a couple of puddles – those objects available for re-use and those awaiting reinitialization.
Rgds,
Martin