org.electrocodeogram.cpc.core.api.provider
Interface IPoolableProvider

All Superinterfaces:
IManagableProvider, IProvider

public interface IPoolableProvider
extends IManagableProvider

A special extension interface of IManagableProvider for service providers which want to request instance pooling.

A provider which prefers instance pooling over the creation of a new instance for every client lookup should implement this interface.
Whenever possible it is recommended for providers to be registered as singletons.

An IProviderRegistry implementation is not required to support provider instance pooling. If pooling is not supported, providers implementing this interface are handled like normal IManagableProviders.

Author:
vw

Method Summary
 void addedToPool()
          Called when a new provider instance is first added to an instance pool.
 void leavingPool()
          Called shortly before this instance is handed out to a client.
 void removedFromPool()
          Called shortly before provider instance is removed from the pool and discarded.
 void returningToPool()
          Called shortly after a client has indicated that it no longer needs this instance and the instance is about to be returned to the pool.
 
Methods inherited from interface org.electrocodeogram.cpc.core.api.provider.IManagableProvider
onLoad, onUnload
 
Methods inherited from interface org.electrocodeogram.cpc.core.api.provider.IProvider
getProviderName, toString
 

Method Detail

addedToPool

void addedToPool()
Called when a new provider instance is first added to an instance pool.
This method is guaranteed to be called before leavingPool() and removedFromPool().

A provider implementation can use a call to this method as indication of pooling support in the current provider registry. If the provider is used before this method is called, pooling is not supported.


removedFromPool

void removedFromPool()
Called shortly before provider instance is removed from the pool and discarded.
This typically happens on shutdown or when the provider registry decides that there are too many unused instances in the pool.


leavingPool

void leavingPool()
Called shortly before this instance is handed out to a client.


returningToPool

void returningToPool()
Called shortly after a client has indicated that it no longer needs this instance and the instance is about to be returned to the pool.