Package com.sun.enterprise.resource.pool
Class PoolManagerImpl
- java.lang.Object
-
- com.sun.enterprise.resource.pool.AbstractPoolManager
-
- com.sun.enterprise.resource.pool.PoolManagerImpl
-
- All Implemented Interfaces:
TransactedPoolManager,PoolManager,ComponentInvocationHandler
@Service public class PoolManagerImpl extends AbstractPoolManager implements ComponentInvocationHandler
- Author:
- Tony Ng, Aditya Gore
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringManagerlocalStrings-
Fields inherited from interface com.sun.enterprise.resource.pool.PoolManager
BASIC_PASSWORD, GENERIC_CREDENTIAL, KERBV5, LOCAL_TRANSACTION, NO_TRANSACTION, PASSWORD_CREDENTIAL, XA_TRANSACTION
-
-
Constructor Summary
Constructors Constructor Description PoolManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPostInvoke(ComponentInvocation.ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation curInv)Called after the curInv has been popped from the invocation stack.voidafterPreInvoke(ComponentInvocation.ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation curInv)Called after the cur has been pushed into the invocation stack.voidbadResourceClosed(ResourceHandle resource)voidbeforePostInvoke(ComponentInvocation.ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation curInv)Called before the cur has been popped from the invocation stack.voidbeforePreInvoke(ComponentInvocation.ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation newInv)Called before the cur is pushed into the invocation stack.voidcreateEmptyConnectionPool(PoolInfo poolInfo, ConnectorConstants.PoolType pt, Hashtable env)booleanflushConnectionPool(PoolInfo poolInfo)Flush Connection pool by reinitializing the connections established in the pool.ResourcePoolgetPool(PoolInfo poolInfo)PoolStatusgetPoolStatus(PoolInfo poolInfo)Get connection pool status.ObjectgetResource(ResourceSpec spec, ResourceAllocator alloc, ClientSecurityInfo info)Obtain a transactional resource such as JDBC connectionResourceHandlegetResourceFromPool(ResourceSpec spec, ResourceAllocator alloc, ClientSecurityInfo info, jakarta.transaction.Transaction tran)ResourceReferenceDescriptorgetResourceReference(String jndiName, String logicalName)voidkillFreeConnectionsInPools()voidkillPool(PoolInfo poolInfo)Kill the pool with the specified pool namevoidlazyEnlist(jakarta.resource.spi.ManagedConnection mc)This method gets called by the LazyEnlistableConnectionManagerImpl when a connection needs enlistment, i.e on use of a Statement etc.voidputbackBadResourceToPool(ResourceHandle h)voidputbackDirectToPool(ResourceHandle h, PoolInfo poolInfo)voidputbackResourceToPool(ResourceHandle h, boolean errorOccurred)voidreconfigPoolProperties(ConnectorConnectionPool ccp)voidregisterPoolLifeCycleListener(PoolLifeCycle poolListener)voidregisterResource(ResourceHandle handle)registers the provided resource with the component & enlists the resource in the transactionvoidresourceAbortOccurred(ResourceHandle resource)voidresourceClosed(ResourceHandle resource)voidresourceEnlisted(jakarta.transaction.Transaction tran, ResourceHandle h)Indicate that a resource is enlisted.voidresourceErrorOccurred(ResourceHandle resource)booleanswitchOnMatching(PoolInfo poolInfo)Switch on matching in the pool.voidtransactionCompleted(jakarta.transaction.Transaction tran, int status)voidunregisterPoolLifeCycleListener()voidunregisterResource(ResourceHandle resource, int xaresFlag)unregisters the resource from the component and delists the resource from the transaction-
Methods inherited from class com.sun.enterprise.resource.pool.AbstractPoolManager
emptyResourcePool, getMonitoredPoolTable, killAllPools, setSelfManaged
-
-
-
-
Field Detail
-
localStrings
protected static final StringManager localStrings
-
-
Method Detail
-
createEmptyConnectionPool
public void createEmptyConnectionPool(PoolInfo poolInfo, ConnectorConstants.PoolType pt, Hashtable env) throws PoolingException
- Specified by:
createEmptyConnectionPoolin interfacePoolManager- Throws:
PoolingException
-
getResource
public Object getResource(ResourceSpec spec, ResourceAllocator alloc, ClientSecurityInfo info) throws PoolingException, jakarta.resource.spi.RetryableUnavailableException
Description copied from interface:PoolManagerObtain a transactional resource such as JDBC connection- Specified by:
getResourcein interfacePoolManager- Parameters:
spec- Specification for the resourcealloc- Allocator for the resourceinfo- Client security for this request- Returns:
- An object that represents a connection to the resource
- Throws:
PoolingException- Thrown if some error occurs while obtaining the resourcejakarta.resource.spi.RetryableUnavailableException
-
putbackDirectToPool
public void putbackDirectToPool(ResourceHandle h, PoolInfo poolInfo)
- Specified by:
putbackDirectToPoolin interfacePoolManager
-
getResourceFromPool
public ResourceHandle getResourceFromPool(ResourceSpec spec, ResourceAllocator alloc, ClientSecurityInfo info, jakarta.transaction.Transaction tran) throws PoolingException, jakarta.resource.spi.RetryableUnavailableException
- Specified by:
getResourceFromPoolin interfacePoolManager- Throws:
PoolingExceptionjakarta.resource.spi.RetryableUnavailableException
-
switchOnMatching
public boolean switchOnMatching(PoolInfo poolInfo)
Switch on matching in the pool.- Specified by:
switchOnMatchingin interfacePoolManager- Parameters:
poolInfo- Name of the pool
-
transactionCompleted
public void transactionCompleted(jakarta.transaction.Transaction tran, int status) throws IllegalStateException- Specified by:
transactionCompletedin interfacePoolManager- Throws:
IllegalStateException
-
resourceEnlisted
public void resourceEnlisted(jakarta.transaction.Transaction tran, ResourceHandle h) throws IllegalStateExceptionDescription copied from interface:TransactedPoolManagerIndicate that a resource is enlisted.- Specified by:
resourceEnlistedin interfaceTransactedPoolManager- Parameters:
tran- Transaction to which the resource is enlistedh- Resource that is enlisted- Throws:
IllegalStateException- when unable to enlist the resource
-
lazyEnlist
public void lazyEnlist(jakarta.resource.spi.ManagedConnection mc) throws jakarta.resource.ResourceExceptionThis method gets called by the LazyEnlistableConnectionManagerImpl when a connection needs enlistment, i.e on use of a Statement etc.- Specified by:
lazyEnlistin interfacePoolManager- Throws:
jakarta.resource.ResourceException
-
registerResource
public void registerResource(ResourceHandle handle) throws PoolingException
Description copied from interface:TransactedPoolManagerregisters the provided resource with the component & enlists the resource in the transaction- Specified by:
registerResourcein interfaceTransactedPoolManager- Parameters:
handle- resource-handle- Throws:
PoolingException- when unable to register the resource
-
registerPoolLifeCycleListener
public void registerPoolLifeCycleListener(PoolLifeCycle poolListener)
- Specified by:
registerPoolLifeCycleListenerin interfacePoolManager
-
unregisterPoolLifeCycleListener
public void unregisterPoolLifeCycleListener()
- Specified by:
unregisterPoolLifeCycleListenerin interfacePoolManager
-
unregisterResource
public void unregisterResource(ResourceHandle resource, int xaresFlag)
Description copied from interface:TransactedPoolManagerunregisters the resource from the component and delists the resource from the transaction- Specified by:
unregisterResourcein interfaceTransactedPoolManager- Parameters:
resource- resource-handle
-
resourceClosed
public void resourceClosed(ResourceHandle resource)
- Specified by:
resourceClosedin interfacePoolManager
-
badResourceClosed
public void badResourceClosed(ResourceHandle resource)
- Specified by:
badResourceClosedin interfacePoolManager
-
resourceErrorOccurred
public void resourceErrorOccurred(ResourceHandle resource)
- Specified by:
resourceErrorOccurredin interfacePoolManager
-
resourceAbortOccurred
public void resourceAbortOccurred(ResourceHandle resource)
- Specified by:
resourceAbortOccurredin interfacePoolManager
-
putbackBadResourceToPool
public void putbackBadResourceToPool(ResourceHandle h)
- Specified by:
putbackBadResourceToPoolin interfacePoolManager
-
putbackResourceToPool
public void putbackResourceToPool(ResourceHandle h, boolean errorOccurred)
- Specified by:
putbackResourceToPoolin interfacePoolManager
-
getPool
public ResourcePool getPool(PoolInfo poolInfo)
- Specified by:
getPoolin interfacePoolManager
-
killPool
public void killPool(PoolInfo poolInfo)
Kill the pool with the specified pool name- Specified by:
killPoolin interfacePoolManager- Parameters:
poolInfo- - The name of the pool to kill
-
killFreeConnectionsInPools
public void killFreeConnectionsInPools()
- Specified by:
killFreeConnectionsInPoolsin interfacePoolManager
-
getResourceReference
public ResourceReferenceDescriptor getResourceReference(String jndiName, String logicalName)
- Specified by:
getResourceReferencein interfacePoolManager
-
beforePreInvoke
public void beforePreInvoke(ComponentInvocation.ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation newInv) throws InvocationException
Description copied from interface:ComponentInvocationHandlerCalled before the cur is pushed into the invocation stack.- Specified by:
beforePreInvokein interfaceComponentInvocationHandler- Throws:
InvocationException
-
afterPreInvoke
public void afterPreInvoke(ComponentInvocation.ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation curInv) throws InvocationException
Description copied from interface:ComponentInvocationHandlerCalled after the cur has been pushed into the invocation stack.- Specified by:
afterPreInvokein interfaceComponentInvocationHandler- Throws:
InvocationException
-
beforePostInvoke
public void beforePostInvoke(ComponentInvocation.ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation curInv) throws InvocationException
Description copied from interface:ComponentInvocationHandlerCalled before the cur has been popped from the invocation stack.- Specified by:
beforePostInvokein interfaceComponentInvocationHandler- Throws:
InvocationException
-
afterPostInvoke
public void afterPostInvoke(ComponentInvocation.ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation curInv) throws InvocationException
Description copied from interface:ComponentInvocationHandlerCalled after the curInv has been popped from the invocation stack.- Specified by:
afterPostInvokein interfaceComponentInvocationHandler- Throws:
InvocationException
-
reconfigPoolProperties
public void reconfigPoolProperties(ConnectorConnectionPool ccp) throws PoolingException
- Specified by:
reconfigPoolPropertiesin interfacePoolManager- Throws:
PoolingException
-
flushConnectionPool
public boolean flushConnectionPool(PoolInfo poolInfo) throws PoolingException
Flush Connection pool by reinitializing the connections established in the pool.- Specified by:
flushConnectionPoolin interfacePoolManager- Parameters:
poolInfo-- Throws:
PoolingException
-
getPoolStatus
public PoolStatus getPoolStatus(PoolInfo poolInfo)
Get connection pool status.- Specified by:
getPoolStatusin interfacePoolManager- Parameters:
poolInfo-- Returns:
-
-