org.base.apps.xml.pool
Class XmlResourcePool

java.lang.Object
  extended by org.base.apps.xml.pool.XmlResourcePool

public class XmlResourcePool
extends Object

Pool of XmlResources.

Author:
Kevan Simpson

Constructor Summary
XmlResourcePool()
          Constructs an XmlResourcePool with default configuration.
 
Method Summary
 XmlResource acquire()
          Fetches an XmlResource from the pool, if one is available.
 void clear()
          Empties the pool of idle XmlResources, not accounting for resources currently checked out of the pool via acquire().
 int getAcquiredCount()
          Returns the number of XmlResources checked out of this pool.
 int getIdleCount()
          Returns the number of XmlResources idle in this pool.
protected  GenericObjectPool getObjectPool()
           
static XmlResourcePool getPool()
          Fetches the global XmlResourcePool.
 int getTotalCount()
          Returns the total number of XmlResources managed by this pool.
protected  void init()
          Initializes the pool implementation to grow as needed.
 void release(XmlResource rsrc)
          Releases an XmlResource back to this pool.
protected  void setObjectPool(GenericObjectPool pool)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlResourcePool

public XmlResourcePool()
Constructs an XmlResourcePool with default configuration.

Method Detail

getPool

public static XmlResourcePool getPool()
Fetches the global XmlResourcePool.

Returns:
the global XmlResourcePool.

acquire

public XmlResource acquire()
Fetches an XmlResource from the pool, if one is available.

Returns:
an XmlResource or null, if the pool is empty.

release

public void release(XmlResource rsrc)
Releases an XmlResource back to this pool.

Parameters:
rsrc - An XmlResource.

clear

public void clear()
Empties the pool of idle XmlResources, not accounting for resources currently checked out of the pool via acquire().


getAcquiredCount

public int getAcquiredCount()
Returns the number of XmlResources checked out of this pool.

Returns:
the number of XmlResources checked out of this pool.

getIdleCount

public int getIdleCount()
Returns the number of XmlResources idle in this pool.

Returns:
the number of XmlResources idle in this pool.

getTotalCount

public int getTotalCount()
Returns the total number of XmlResources managed by this pool.

Returns:
the total number of XmlResources managed by this pool.

init

protected void init()
Initializes the pool implementation to grow as needed.


getObjectPool

protected GenericObjectPool getObjectPool()
Returns:
the pool

setObjectPool

protected void setObjectPool(GenericObjectPool pool)
Parameters:
pool - the pool to set

Please visit Base Apps, hosted on Sourceforge.net.

Copyright 2011, Blue Agate Software Entity (BASE)