Save This Page
Home » commons-pool-1.4-src » org.apache.commons » pool » impl » [javadoc | source]
org.apache.commons.pool.impl
public class: SoftReferenceObjectPool [javadoc | source]
java.lang.Object
   org.apache.commons.pool.BaseObjectPool
      org.apache.commons.pool.impl.SoftReferenceObjectPool

All Implemented Interfaces:
    ObjectPool

A SoftReference based ObjectPool .
Constructor:
 public SoftReferenceObjectPool() 
 public SoftReferenceObjectPool(PoolableObjectFactory factory) 
    Create a SoftReferenceObjectPool with the specified factory.
    Parameters:
    factory - object factory to use.
 public SoftReferenceObjectPool(PoolableObjectFactory factory,
    int initSize) throws Exception, IllegalArgumentException 
    Create a SoftReferenceObjectPool with the specified factory and initial idle object count.
    Parameters:
    factory - object factory to use.
    initSize - initial size to attempt to prefill the pool.
    Throws:
    Exception - when there is a problem prefilling the pool.
    IllegalArgumentException - when factory is null.
Method from org.apache.commons.pool.impl.SoftReferenceObjectPool Summary:
addObject,   borrowObject,   clear,   close,   getNumActive,   getNumIdle,   invalidateObject,   returnObject,   setFactory
Methods from org.apache.commons.pool.BaseObjectPool:
addObject,   assertOpen,   borrowObject,   clear,   close,   getNumActive,   getNumIdle,   invalidateObject,   isClosed,   returnObject,   setFactory
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.commons.pool.impl.SoftReferenceObjectPool Detail:
 public synchronized  void addObject() throws Exception 
    Create an object, and place it into the pool. addObject() is useful for "pre-loading" a pool with idle objects.
 public synchronized Object borrowObject() throws Exception 
 public synchronized  void clear() 
    Clears any objects sitting idle in the pool.
 public  void close() throws Exception 
 public synchronized int getNumActive() 
    Return the number of instances currently borrowed from this pool.
 public synchronized int getNumIdle() 
    Returns an approximation not less than the of the number of idle instances in the pool.
 public synchronized  void invalidateObject(Object obj) throws Exception 
 public synchronized  void returnObject(Object obj) throws Exception 
 public synchronized  void setFactory(PoolableObjectFactory factory) throws IllegalStateException 
    Sets the factory this pool uses to create new instances. Trying to change the factory while there are borrowed objects will throw an IllegalStateException .