The pool will only manage instances that were explicitly passed into the pool before. For more sophisticated pooling strategies, derive from this class or wrap it.
The implementation will provide these instances wrapped by a proxy, that will return the instance automatically to the pool, if it falls out of scope and is collected by the garbage collector. Since the pool only returns instances wrapped by a proxy that implements the {@link Poolable} interface, this can be used to release th instance manuallyto the pool also. With an implementation of the {@link Resetter} interface each element's status can be reset or theelement can be dropped from the pool at all, if it is exhausted.
A client can use the pool's monitor for an improved synchronization. Everytime an object is returned to the pool, all waiting Threads of the monitor will be notified. This notification will happen independently of the result of the {@link Resetter#reset(Object)} method.
@author Jörg Schaible @since 0.2 @see com.thoughtworks.proxy.toys.pool
|
|
|
|