org.apache.turbine.services.pool
Class TurbinePool

java.lang.Object
  extended byorg.apache.turbine.services.pool.TurbinePool

public abstract class TurbinePool
extends java.lang.Object

This is a static accessor to common pooling tasks.

Version:
$Id: TurbinePool.java 534527 2007-05-02 16:10:59Z tv $
Author:
Ilkka Priha

Constructor Summary
TurbinePool()
           
 
Method Summary
static 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.
static 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.
static 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.
static 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.
static 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.
static 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.
static PoolService getService()
          Gets the pool service implementation.
static boolean putInstance(java.lang.Object instance)
          Puts a used object back to the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TurbinePool

public TurbinePool()
Method Detail

getInstance

public static java.lang.Object getInstance(java.lang.String className)
                                    throws TurbineException
Gets an instance of a named class either from the pool or by calling the Factory Service if the pool is empty.

Parameters:
className - the name of the class.
Returns:
the instance.
Throws:
TurbineException - if recycling fails.

getInstance

public static java.lang.Object getInstance(java.lang.String className,
                                           java.lang.ClassLoader loader)
                                    throws TurbineException
Gets an instance of a named class either from the pool or by calling the Factory Service if the pool is empty. The specified class loader will be passed to the Factory Service.

Parameters:
className - the name of the class.
loader - the class loader.
Returns:
the instance.
Throws:
TurbineException - if recycling fails.

getInstance

public static java.lang.Object getInstance(java.lang.String className,
                                           java.lang.Object[] params,
                                           java.lang.String[] signature)
                                    throws TurbineException
Gets an instance of a named class either from the pool or by calling the Factory Service if the pool is empty. Parameters for its constructor are given as an array of objects, primitive types must be wrapped with a corresponding class.

Parameters:
className - the name of the class.
params - an array containing the parameters of the constructor.
signature - an array containing the signature of the constructor.
Returns:
the instance.
Throws:
TurbineException - if recycling fails.

getInstance

public static java.lang.Object getInstance(java.lang.String className,
                                           java.lang.ClassLoader loader,
                                           java.lang.Object[] params,
                                           java.lang.String[] signature)
                                    throws TurbineException
Gets an instance of a named class either from the pool or by calling the Factory Service if the pool is empty. Parameters for its constructor are given as an array of objects, primitive types must be wrapped with a corresponding class. The specified class loader will be passed to the Factory Service.

Parameters:
className - 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.
Returns:
the instance.
Throws:
TurbineException - if recycling fails.

getInstance

public static java.lang.Object getInstance(java.lang.Class clazz)
                                    throws TurbineException
Gets an instance of a specified class either from the pool or by instatiating from the class if the pool is empty.

Parameters:
clazz - the class.
Returns:
the instance.
Throws:
TurbineException - if recycling fails.

getInstance

public static java.lang.Object getInstance(java.lang.Class clazz,
                                           java.lang.Object[] params,
                                           java.lang.String[] signature)
                                    throws TurbineException
Gets an instance of a specified class either from the pool or by instatiating from the class if the pool is empty.

Parameters:
clazz - the class.
params - an array containing the parameters of the constructor.
signature - an array containing the signature of the constructor.
Returns:
the instance.
Throws:
TurbineException - if recycling fails.

putInstance

public static boolean putInstance(java.lang.Object instance)
Puts a used object back to the pool. Objects implementing the Recyclable interface can provide a recycle method to be called when they are reused and a dispose method to be called when they are returned to the pool.

Parameters:
instance - the object instance to recycle.
Returns:
true if the instance was accepted.

getService

public static PoolService getService()
Gets the pool service implementation.

Returns:
the pool service implementation.


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.