com.ibm.portal.pool
Interface ObjectPool<E>


public interface ObjectPool<E>

Interface modeling an object pool. The basic operations of an object pool include requesting objects from the pool as well as putting them back when they are not used any longer.

Since:
6.1.0.1

Method Summary
 int compact()
          Compact the pool to avoid excessive memory consumption.
 E get()
          Returns an object from the pool.
 void put(E obj)
          Returns an object previously fetched from this pool to the pool.
 void putAll(java.util.Collection<? extends E> obj)
          Returns a batch of objects previously fetched from the pool
 void reset()
          Clears the internal state of the pool.
 

Method Detail

get

E get()
      throws ObjectInstantiationException
Returns an object from the pool. This object has either been newly created or fetched from an internal stack of available objects.

Returns:
object Object from the pool.
Throws:
ObjectInstantiationException - if a new object could not be instantiated

put

void put(E obj)
Returns an object previously fetched from this pool to the pool.

Parameters:
obj - Object to be returned to the pool.

putAll

void putAll(java.util.Collection<? extends E> obj)
Returns a batch of objects previously fetched from the pool

Parameters:
obj - Object to be returned to the pool.

reset

void reset()
Clears the internal state of the pool.


compact

int compact()
Compact the pool to avoid excessive memory consumption.

Returns:
the current size of the pool