com.metamatrix.common.pooling.api
Interface ResourcePool

All Known Implementing Classes:
BasicResourcePool

public interface ResourcePool

The ResourcePool is the manager for a specific set of resource instances. A new ResourcePool is created for each different descriptor that is compared using the equals method. Based on the minimum resource size, the pool will be initialized with that many resource instances. The maximum resource size controls the number of resource instances that will be available at one time.


Nested Class Summary
static interface ResourcePool.Defaults
           
 
Field Summary
static java.lang.String JDBC_SHARED_CONNECTION_POOL
          The well-known pool that is commonly used for the majority of the internal resources/services (i.e., DirectoryService, ConfigurationService, etc.).
static java.lang.String RESOURCE_POOL
          The environment property that indicates the name of the pool.
 
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.
 ComponentTypeID getComponentTypeID()
          Returns the com.metamatrix.common.config.ComponentTypeID that identifies the type of pool these statistics represent.
 java.util.Collection getPoolResourceStatistics()
          Returns a collection of statistics for resources in this 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.
 void shutDown()
          Call to shutDown all the resources in the pool.
 void update(java.util.Properties properties)
          Call to update the pool management parameters based on the resource descriptor.
 

Field Detail

RESOURCE_POOL

static final java.lang.String RESOURCE_POOL
The environment property that indicates the name of the pool.

See Also:
Constant Field Values

JDBC_SHARED_CONNECTION_POOL

static final java.lang.String JDBC_SHARED_CONNECTION_POOL
The well-known pool that is commonly used for the majority of the internal resources/services (i.e., DirectoryService, ConfigurationService, etc.).

See Also:
Constant Field Values
Method Detail

init

void init(ResourceDescriptor descriptor)
          throws ResourcePoolException
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.

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

getResourceDescriptorID

ResourceDescriptorID getResourceDescriptorID()
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.

Returns:
ResourceDescriptorID is the resource pool id

getComponentTypeID

ComponentTypeID getComponentTypeID()
Returns the com.metamatrix.common.config.ComponentTypeID that identifies the type of pool these statistics represent.

Returns:
ComponentTypeID is the type id

getResourcePoolSize

int getResourcePoolSize()
Returns the current size of the resource pool.

Parameters:
userName - of who is requesting the resource
Returns:
int the number of ResourceContainers in the pool

checkOut

Resource checkOut(java.lang.String userName)
                  throws ResourcePoolException
Returns a resource from the pool.

Parameters:
userName - of who is requesting the resource
Returns:
Resource that is from the pool
Throws:
ResourcePoolException - is thrown if an error occurs

checkIn

void checkIn(ResourceContainer resourceContainer,
             java.lang.String userName)
             throws ResourcePoolException
Called by the resource container to checkin itself to the pool.

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

getResourceDescriptor

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

Returns:
ResourceDescriptor used to create the resources in the pool

getResourcePoolStatistics

ResourcePoolStatistics getResourcePoolStatistics()
Returns the monitor for this pool.

Returns:
ResourcePoolMonitor that monitors this pool

getPoolResourceStatistics

java.util.Collection getPoolResourceStatistics()
Returns a collection of statistics for resources in this pool.

Returns:
Collection of ResourceStatistics objects.

getResourceAdapter

ResourceAdapter getResourceAdapter()
Returns the resource adapter used to create the phyical resource objects.

Returns:
ResourceAdapter used to create resource objects.

shutDown

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


update

void update(java.util.Properties properties)
            throws ResourcePoolException
Call to update the pool management parameters based on the resource descriptor. This could include changing the size of the pool.

Parameters:
properties - are the changes to be applied
Throws:
ResourcePoolException - is thrown if an error ocurrs


Copyright © 2009. All Rights Reserved.