Abstract pool provides the basic implementation of an object pool. The implementation
uses a linked list to maintain a collection of (available) objects. If the pool is
empty it simply creates one using the ObjectFactory instance. Subclasses can change
this behaviour by overriding getObject(...) and returnObject(....) methods. This
class provides basic support for synchronization, event notification, pool shutdown
and pool object recycling. It also does some very basic bookkeeping like the
number of objects created, number of threads waiting for object.
Subclasses can make use of these book-keeping data to provide complex pooling
mechanism like LRU / MRU / Random. Also, note that AbstractPool does not have a
notion of pool limit. It is upto to the derived classes to implement these features.
This class does not define the canCreate() method. |