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 StringManager
localStrings
-
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 void
afterPostInvoke(ComponentInvocation.ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation curInv)
Called after the curInv has been popped from the invocation stack.void
afterPreInvoke(ComponentInvocation.ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation curInv)
Called after the cur has been pushed into the invocation stack.void
badResourceClosed(ResourceHandle resource)
void
beforePostInvoke(ComponentInvocation.ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation curInv)
Called before the cur has been popped from the invocation stack.void
beforePreInvoke(ComponentInvocation.ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation newInv)
Called before the cur is pushed into the invocation stack.void
createEmptyConnectionPool(PoolInfo poolInfo, ConnectorConstants.PoolType pt, Hashtable env)
boolean
flushConnectionPool(PoolInfo poolInfo)
Flush Connection pool by reinitializing the connections established in the pool.ResourcePool
getPool(PoolInfo poolInfo)
PoolStatus
getPoolStatus(PoolInfo poolInfo)
Get connection pool status.Object
getResource(ResourceSpec spec, ResourceAllocator alloc, ClientSecurityInfo info)
Obtain a transactional resource such as JDBC connectionResourceHandle
getResourceFromPool(ResourceSpec spec, ResourceAllocator alloc, ClientSecurityInfo info, jakarta.transaction.Transaction tran)
ResourceReferenceDescriptor
getResourceReference(String jndiName, String logicalName)
void
killFreeConnectionsInPools()
void
killPool(PoolInfo poolInfo)
Kill the pool with the specified pool namevoid
lazyEnlist(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.void
putbackBadResourceToPool(ResourceHandle h)
void
putbackDirectToPool(ResourceHandle h, PoolInfo poolInfo)
void
putbackResourceToPool(ResourceHandle h, boolean errorOccurred)
void
reconfigPoolProperties(ConnectorConnectionPool ccp)
void
registerPoolLifeCycleListener(PoolLifeCycle poolListener)
void
registerResource(ResourceHandle handle)
registers the provided resource with the component & enlists the resource in the transactionvoid
resourceAbortOccurred(ResourceHandle resource)
void
resourceClosed(ResourceHandle resource)
void
resourceEnlisted(jakarta.transaction.Transaction tran, ResourceHandle h)
Indicate that a resource is enlisted.void
resourceErrorOccurred(ResourceHandle resource)
boolean
switchOnMatching(PoolInfo poolInfo)
Switch on matching in the pool.void
transactionCompleted(jakarta.transaction.Transaction tran, int status)
void
unregisterPoolLifeCycleListener()
void
unregisterResource(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:
createEmptyConnectionPool
in interfacePoolManager
- Throws:
PoolingException
-
getResource
public Object getResource(ResourceSpec spec, ResourceAllocator alloc, ClientSecurityInfo info) throws PoolingException, jakarta.resource.spi.RetryableUnavailableException
Description copied from interface:PoolManager
Obtain a transactional resource such as JDBC connection- Specified by:
getResource
in 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:
putbackDirectToPool
in interfacePoolManager
-
getResourceFromPool
public ResourceHandle getResourceFromPool(ResourceSpec spec, ResourceAllocator alloc, ClientSecurityInfo info, jakarta.transaction.Transaction tran) throws PoolingException, jakarta.resource.spi.RetryableUnavailableException
- Specified by:
getResourceFromPool
in interfacePoolManager
- Throws:
PoolingException
jakarta.resource.spi.RetryableUnavailableException
-
switchOnMatching
public boolean switchOnMatching(PoolInfo poolInfo)
Switch on matching in the pool.- Specified by:
switchOnMatching
in interfacePoolManager
- Parameters:
poolInfo
- Name of the pool
-
transactionCompleted
public void transactionCompleted(jakarta.transaction.Transaction tran, int status) throws IllegalStateException
- Specified by:
transactionCompleted
in interfacePoolManager
- Throws:
IllegalStateException
-
resourceEnlisted
public void resourceEnlisted(jakarta.transaction.Transaction tran, ResourceHandle h) throws IllegalStateException
Description copied from interface:TransactedPoolManager
Indicate that a resource is enlisted.- Specified by:
resourceEnlisted
in 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.ResourceException
This method gets called by the LazyEnlistableConnectionManagerImpl when a connection needs enlistment, i.e on use of a Statement etc.- Specified by:
lazyEnlist
in interfacePoolManager
- Throws:
jakarta.resource.ResourceException
-
registerResource
public void registerResource(ResourceHandle handle) throws PoolingException
Description copied from interface:TransactedPoolManager
registers the provided resource with the component & enlists the resource in the transaction- Specified by:
registerResource
in interfaceTransactedPoolManager
- Parameters:
handle
- resource-handle- Throws:
PoolingException
- when unable to register the resource
-
registerPoolLifeCycleListener
public void registerPoolLifeCycleListener(PoolLifeCycle poolListener)
- Specified by:
registerPoolLifeCycleListener
in interfacePoolManager
-
unregisterPoolLifeCycleListener
public void unregisterPoolLifeCycleListener()
- Specified by:
unregisterPoolLifeCycleListener
in interfacePoolManager
-
unregisterResource
public void unregisterResource(ResourceHandle resource, int xaresFlag)
Description copied from interface:TransactedPoolManager
unregisters the resource from the component and delists the resource from the transaction- Specified by:
unregisterResource
in interfaceTransactedPoolManager
- Parameters:
resource
- resource-handle
-
resourceClosed
public void resourceClosed(ResourceHandle resource)
- Specified by:
resourceClosed
in interfacePoolManager
-
badResourceClosed
public void badResourceClosed(ResourceHandle resource)
- Specified by:
badResourceClosed
in interfacePoolManager
-
resourceErrorOccurred
public void resourceErrorOccurred(ResourceHandle resource)
- Specified by:
resourceErrorOccurred
in interfacePoolManager
-
resourceAbortOccurred
public void resourceAbortOccurred(ResourceHandle resource)
- Specified by:
resourceAbortOccurred
in interfacePoolManager
-
putbackBadResourceToPool
public void putbackBadResourceToPool(ResourceHandle h)
- Specified by:
putbackBadResourceToPool
in interfacePoolManager
-
putbackResourceToPool
public void putbackResourceToPool(ResourceHandle h, boolean errorOccurred)
- Specified by:
putbackResourceToPool
in interfacePoolManager
-
getPool
public ResourcePool getPool(PoolInfo poolInfo)
- Specified by:
getPool
in interfacePoolManager
-
killPool
public void killPool(PoolInfo poolInfo)
Kill the pool with the specified pool name- Specified by:
killPool
in interfacePoolManager
- Parameters:
poolInfo
- - The name of the pool to kill
-
killFreeConnectionsInPools
public void killFreeConnectionsInPools()
- Specified by:
killFreeConnectionsInPools
in interfacePoolManager
-
getResourceReference
public ResourceReferenceDescriptor getResourceReference(String jndiName, String logicalName)
- Specified by:
getResourceReference
in interfacePoolManager
-
beforePreInvoke
public void beforePreInvoke(ComponentInvocation.ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation newInv) throws InvocationException
Description copied from interface:ComponentInvocationHandler
Called before the cur is pushed into the invocation stack.- Specified by:
beforePreInvoke
in interfaceComponentInvocationHandler
- Throws:
InvocationException
-
afterPreInvoke
public void afterPreInvoke(ComponentInvocation.ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation curInv) throws InvocationException
Description copied from interface:ComponentInvocationHandler
Called after the cur has been pushed into the invocation stack.- Specified by:
afterPreInvoke
in interfaceComponentInvocationHandler
- Throws:
InvocationException
-
beforePostInvoke
public void beforePostInvoke(ComponentInvocation.ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation curInv) throws InvocationException
Description copied from interface:ComponentInvocationHandler
Called before the cur has been popped from the invocation stack.- Specified by:
beforePostInvoke
in interfaceComponentInvocationHandler
- Throws:
InvocationException
-
afterPostInvoke
public void afterPostInvoke(ComponentInvocation.ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation curInv) throws InvocationException
Description copied from interface:ComponentInvocationHandler
Called after the curInv has been popped from the invocation stack.- Specified by:
afterPostInvoke
in interfaceComponentInvocationHandler
- Throws:
InvocationException
-
reconfigPoolProperties
public void reconfigPoolProperties(ConnectorConnectionPool ccp) throws PoolingException
- Specified by:
reconfigPoolProperties
in interfacePoolManager
- Throws:
PoolingException
-
flushConnectionPool
public boolean flushConnectionPool(PoolInfo poolInfo) throws PoolingException
Flush Connection pool by reinitializing the connections established in the pool.- Specified by:
flushConnectionPool
in interfacePoolManager
- Parameters:
poolInfo
-- Throws:
PoolingException
-
getPoolStatus
public PoolStatus getPoolStatus(PoolInfo poolInfo)
Get connection pool status.- Specified by:
getPoolStatus
in interfacePoolManager
- Parameters:
poolInfo
-- Returns:
-
-