com.metamatrix.common.pooling.impl
Class BasicResourcePool

java.lang.Object
  extended by com.metamatrix.common.pooling.impl.BasicResourcePool
All Implemented Interfaces:
ResourcePool

public class BasicResourcePool
extends java.lang.Object
implements ResourcePool

NOTE: Currently, the pool does not use the ConcurrentUser option The moving of a container from the resourcepool to the inuseresourcepool is done when a resource is checkedout and backin The logic doesn't consider the concurrent user option History: Who When Why ================================================================= V.Halbert 5/15/03 remove the isAlive checking due to db overhead just let the cleanup thread perform the isAlive cleanup


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.metamatrix.common.pooling.api.ResourcePool
ResourcePool.Defaults
 
Field Summary
protected static java.lang.String CONTEXT
           
protected  ResourceDescriptor resourceDescriptor
           
 
Fields inherited from interface com.metamatrix.common.pooling.api.ResourcePool
JDBC_SHARED_CONNECTION_POOL, RESOURCE_POOL
 
Constructor Summary
BasicResourcePool()
           
 
Method Summary
 void checkIn(ResourceContainer resourceContainer, java.lang.String userName)
          Called by the resource container to checkin itself to the pool.
 Resource checkOut(java.lang.String userName)
          Returns a resource from the pool.
protected  Resource checkResourceCache()
           
 void cleanUp()
           
protected  void finalize()
           
 ComponentTypeID getComponentTypeID()
          Returns the com.metamatrix.common.config.ComponentTypeID that identifies the type of pool these statistics represent.
 java.util.Collection getPoolResourceStatistics()
          Returns list of resourceStatistics for all resources in the pool.
 ResourceAdapter getResourceAdapter()
          Returns the resource adapter used to create the phyical resource objects.
 ResourceDescriptor getResourceDescriptor()
          Returns the descriptor from which resources in the were created.
 ResourceDescriptorID getResourceDescriptorID()
          Returns the resource descriptor ID for this pool that to identify the pool.
 int getResourcePoolSize()
          Returns the current size of the resource pool.
 ResourcePoolStatistics getResourcePoolStatistics()
          Returns the monitor for this pool.
 void init(ResourceDescriptor descriptor)
          Call to initialize the pool based on the descriptor.
protected  void initResources()
           
 void shutDown()
          Call to shutDown all the resources in the pool.
 java.lang.String toString()
           
 void update(java.util.Properties properties)
          Call to update the pool management parameters based on the resource descriptor.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

resourceDescriptor

protected ResourceDescriptor resourceDescriptor

CONTEXT

protected static final java.lang.String CONTEXT
See Also:
Constant Field Values
Constructor Detail

BasicResourcePool

public BasicResourcePool()
Method Detail

init

public void init(ResourceDescriptor descriptor)
          throws ResourcePoolException
Description copied from interface: ResourcePool
Call to initialize the pool based on the descriptor. This is where the initial resources, which represent the minimum pool size, will be created and loaded into the pool.

Specified by:
init in interface ResourcePool
Parameters:
descriptor - which determines the type of resource and pool size parameters
Throws:
ResourcePoolException - is thrown if an error ocurrs during initialization

getResourceAdapter

public ResourceAdapter getResourceAdapter()
Description copied from interface: ResourcePool
Returns the resource adapter used to create the phyical resource objects.

Specified by:
getResourceAdapter in interface ResourcePool
Returns:
ResourceAdapter used to create resource objects.

getResourcePoolSize

public int getResourcePoolSize()
Description copied from interface: ResourcePool
Returns the current size of the resource pool.

Specified by:
getResourcePoolSize in interface ResourcePool
Returns:
int the number of ResourceContainers in the pool

getResourceDescriptor

public ResourceDescriptor getResourceDescriptor()
Returns the descriptor from which resources in the were created.

Specified by:
getResourceDescriptor in interface ResourcePool
Returns:
ResourceDescriptor used to create the resources in the pool

getResourceDescriptorID

public ResourceDescriptorID getResourceDescriptorID()
Description copied from interface: ResourcePool
Returns the resource descriptor ID for this pool that to identify the pool. This id is used by the pool manager as another means of finding a specific resource pool.

Specified by:
getResourceDescriptorID in interface ResourcePool
Returns:
ResourceDescriptorID is the resource pool id

getComponentTypeID

public ComponentTypeID getComponentTypeID()
Description copied from interface: ResourcePool
Returns the com.metamatrix.common.config.ComponentTypeID that identifies the type of pool these statistics represent.

Specified by:
getComponentTypeID in interface ResourcePool
Returns:
ComponentTypeID is the type id

getResourcePoolStatistics

public ResourcePoolStatistics getResourcePoolStatistics()
Returns the monitor for this pool.

Specified by:
getResourcePoolStatistics in interface ResourcePool
Returns:
ResourcePoolMonitor that monitors this pool

getPoolResourceStatistics

public java.util.Collection getPoolResourceStatistics()
Returns list of resourceStatistics for all resources in the pool.

Specified by:
getPoolResourceStatistics in interface ResourcePool
Returns:
List

shutDown

public void shutDown()
Call to shutDown all the resources in the pool. Each resource will have the method Resource.shutDown called.

Specified by:
shutDown in interface ResourcePool

update

public void update(java.util.Properties properties)
            throws ResourcePoolException
Description copied from interface: ResourcePool
Call to update the pool management parameters based on the resource descriptor. This could include changing the size of the pool.

Specified by:
update in interface ResourcePool
Parameters:
properties - are the changes to be applied
Throws:
ResourcePoolException - is thrown if an error ocurrs

finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object

checkResourceCache

protected Resource checkResourceCache()

initResources

protected void initResources()
                      throws ResourcePoolException
Throws:
ResourcePoolException

checkOut

public Resource checkOut(java.lang.String userName)
                  throws ResourcePoolException
Description copied from interface: ResourcePool
Returns a resource from the pool.

Specified by:
checkOut in interface ResourcePool
Parameters:
userName - of who is requesting the resource
Returns:
Resource that is from the pool
Throws:
ResourcePoolException - is thrown if an error occurs

checkIn

public void checkIn(ResourceContainer resourceContainer,
                    java.lang.String userName)
             throws ResourcePoolException
Description copied from interface: ResourcePool
Called by the resource container to checkin itself to the pool.

Specified by:
checkIn in interface ResourcePool
Parameters:
resourceContainer - represents the physical resource instance being removed from the pool
userName - of who has the resource checked out
Throws:
ResourcePoolException - is thrown if an error occurs

cleanUp

public void cleanUp()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2009. All Rights Reserved.