|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.turbine.services.BaseInitable
org.apache.turbine.services.BaseService
org.apache.turbine.services.TurbineBaseService
org.apache.turbine.services.pool.TurbinePoolService
The Pool Service extends the Factory Service by adding support for pooling instantiated objects. When a new instance is requested, the service first checks its pool if one is available. If the the pool is empty, a new instance will be requested from the FactoryService.
For objects implementing the Recyclable interface, a recycle method will be called, when they taken from the pool, and a dispose method, when they are returned to the pool.
| Field Summary |
| Fields inherited from class org.apache.turbine.services.BaseService |
configuration, name, serviceBroker |
| Fields inherited from class org.apache.turbine.services.BaseInitable |
initableBroker, isInitialized |
| Fields inherited from interface org.apache.turbine.services.pool.PoolService |
DEFAULT_POOL_CAPACITY, POOL_CAPACITY_KEY, POOL_DEBUG_DEFAULT, POOL_DEBUG_KEY, SERVICE_NAME |
| Constructor Summary | |
TurbinePoolService()
Constructs a Pool Service. |
|
| Method Summary | |
void |
clearPool()
Clears all instances from the pool. |
void |
clearPool(java.lang.String className)
Clears instances of a named class from the pool. |
int |
getCapacity(java.lang.String className)
Gets the capacity of the pool for a named class. |
java.lang.Object |
getInstance(java.lang.Class clazz)
Gets an instance of a specified class either from the pool or by instatiating from the class if the pool is empty. |
java.lang.Object |
getInstance(java.lang.Class clazz,
java.lang.Object[] params,
java.lang.String[] signature)
Gets an instance of a specified class either from the pool or by instatiating from the class if the pool is empty. |
java.lang.Object |
getInstance(java.lang.String className)
Gets an instance of a named class either from the pool or by calling the Factory Service if the pool is empty. |
java.lang.Object |
getInstance(java.lang.String className,
java.lang.ClassLoader loader)
Gets an instance of a named class either from the pool or by calling the Factory Service if the pool is empty. |
java.lang.Object |
getInstance(java.lang.String className,
java.lang.ClassLoader loader,
java.lang.Object[] params,
java.lang.String[] signature)
Gets an instance of a named class either from the pool or by calling the Factory Service if the pool is empty. |
java.lang.Object |
getInstance(java.lang.String className,
java.lang.Object[] params,
java.lang.String[] signature)
Gets an instance of a named class either from the pool or by calling the Factory Service if the pool is empty. |
int |
getSize(java.lang.String className)
Gets the current size of the pool for a named class. |
void |
init()
Initializes the service by setting the pool capacity. |
boolean |
isLoaderSupported(java.lang.String className)
Deprecated. Use TurbineFactory.isLoaderSupported(className); |
boolean |
putInstance(java.lang.Object instance)
Puts a used object back to the pool. |
void |
setCapacity(java.lang.String className,
int capacity)
Sets the capacity of the pool for a named class. |
| Methods inherited from class org.apache.turbine.services.TurbineBaseService |
init, init, init, shutdown |
| Methods inherited from class org.apache.turbine.services.BaseService |
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker |
| Methods inherited from class org.apache.turbine.services.BaseInitable |
getInit, getInitableBroker, setInit, setInitableBroker |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.turbine.services.Service |
getConfiguration, getName, getProperties, setName, setServiceBroker |
| Methods inherited from interface org.apache.turbine.services.Initable |
getInit, init, setInitableBroker, shutdown |
| Constructor Detail |
public TurbinePoolService()
| Method Detail |
public void init()
throws InitializationException
init in interface Initableinit in class TurbineBaseServiceInitializationException - if initialization fails.
public java.lang.Object getInstance(java.lang.String className)
throws TurbineException
getInstance in interface PoolServiceclassName - the name of the class.
TurbineException - if recycling fails.
public java.lang.Object getInstance(java.lang.String className,
java.lang.ClassLoader loader)
throws TurbineException
getInstance in interface PoolServiceclassName - the name of the class.loader - the class loader.
TurbineException - if recycling fails.
public java.lang.Object getInstance(java.lang.String className,
java.lang.Object[] params,
java.lang.String[] signature)
throws TurbineException
getInstance in interface PoolServiceclassName - the name of the class.params - an array containing the parameters of the constructor.signature - an array containing the signature of the constructor.
TurbineException - if recycling fails.
public java.lang.Object getInstance(java.lang.String className,
java.lang.ClassLoader loader,
java.lang.Object[] params,
java.lang.String[] signature)
throws TurbineException
getInstance in interface PoolServiceclassName - the name of the class.loader - the class loader.params - an array containing the parameters of the constructor.signature - an array containing the signature of the constructor.
TurbineException - if recycling fails.
public boolean isLoaderSupported(java.lang.String className)
throws TurbineException
isLoaderSupported in interface PoolServiceclassName - the name of the class.
TurbineException - if test fails.
public java.lang.Object getInstance(java.lang.Class clazz)
throws TurbineException
getInstance in interface PoolServiceclazz - the class.
TurbineException - if recycling fails.
public java.lang.Object getInstance(java.lang.Class clazz,
java.lang.Object[] params,
java.lang.String[] signature)
throws TurbineException
getInstance in interface PoolServiceclazz - the class.params - an array containing the parameters of the constructor.signature - an array containing the signature of the constructor.
TurbineException - if recycling fails.public boolean putInstance(java.lang.Object instance)
putInstance in interface PoolServiceinstance - the object instance to recycle.
public int getCapacity(java.lang.String className)
getCapacity in interface PoolServiceclassName - the name of the class.
public void setCapacity(java.lang.String className,
int capacity)
setCapacity in interface PoolServiceclassName - the name of the class.capacity - the new capacity.public int getSize(java.lang.String className)
getSize in interface PoolServiceclassName - the name of the class.public void clearPool(java.lang.String className)
clearPool in interface PoolServiceclassName - the name of the class.public void clearPool()
clearPool in interface PoolService
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||