Package com.sun.enterprise.resource.pool
Class AssocWithThreadResourcePool
- java.lang.Object
-
- com.sun.enterprise.resource.pool.ConnectionPool
-
- com.sun.enterprise.resource.pool.AssocWithThreadResourcePool
-
- All Implemented Interfaces:
ConnectionLeakListener,PoolProperties,ResourceHandler,ResourcePool
public class AssocWithThreadResourcePool extends ConnectionPool
Associates a resource with the thread. When the same thread is used again, it checks whether the resource associated with the thread can serve the request.- Author:
- Aditya Gore, Jagadish Ramu
-
-
Field Summary
-
Fields inherited from class com.sun.enterprise.resource.pool.ConnectionPool
_logger, allocator, conCreationRetryInterval_, connectionCreationRetry_, connectionCreationRetryAttempts_, dataStructureParameters, dataStructureType, ds, failAllConnections, gateway, idletime, leakDetector, localStrings, matchConnections, maxConnectionUsage_, maxPoolSize, maxWaitTime, poolInfo, poolInitialized, poolLifeCycleListener, poolWaitQueueClass, preferValidateOverRecreate, reconfigWaitQueue, resizeQuantity, resizerTask, resourceGatewayClass, resourceSelectionStrategyClass, steadyPoolSize, timer, validateAtmostPeriodInMilliSeconds_, validation, waitQueue
-
-
Constructor Summary
Constructors Constructor Description AssocWithThreadResourcePool(PoolInfo poolInfo, Hashtable env)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteResource(ResourceHandle resourceHandle)destroys the resourceprotected voidfreeUnenlistedResource(ResourceHandle h)return the resource back to pool only if it is not associated with the thread.protected ResourceHandlegetUnenlistedResource(ResourceSpec spec, ResourceAllocator alloc, jakarta.transaction.Transaction tran)return resource in free list.protected voidinitializePoolDataStructure()protected ResizerinitializeResizer()protected booleanisResourceUnused(ResourceHandle h)check whether the resource is unusedprotected ResourceHandleprefetch(ResourceSpec spec, ResourceAllocator alloc, jakarta.transaction.Transaction tran)Prefetch is called to check whether there there is a free resource is already associated with the thread Only when prefetch is unable to find a resource, normal routine (getUnenlistedResource) will happen.-
Methods inherited from class com.sun.enterprise.resource.pool.ConnectionPool
addResource, blockRequests, cancelResizerTask, cleanupResource, createResource, createResourceAndAddToPool, createSingleResource, createSingleResourceAndAdjustPool, dumpPoolStatus, emptyFreeConnectionsInPool, emptyPool, flushConnectionPool, freeResource, getIdleTimeout, getInvalidConnections, getMaxPoolSize, getPoolConfigurationFromJndi, getPoolInfo, getPoolStatus, getPoolWaitQueue, getReconfigWaitQueue, getReconfigWaitTime, getResizeQuantity, getResource, getResourceFromPool, getSteadyPoolSize, getWaitQueueLength, initializePoolWaitQueue, initializeResourceSelectionStrategy, initPool, internalGetResource, invalidConnectionDetected, isConnectionValid, isSelfManaged, matchConnection, notifyWaitingThreads, performMaxConnectionUsageOperation, potentialConnectionLeakFound, printConnectionLeakTrace, reclaimConnection, reconfigurePool, reconfigureSteadyPoolSize, removePoolLifeCycleListener, resizePool, resourceClosed, resourceEnlisted, resourceErrorOccurred, setMaxPoolSize, setPoolLifeCycleListener, setResourceStateToBusy, setResourceStateToFree, setSelfManaged, setSteadyPoolSize, switchOnMatching, toString, transactionCompleted
-
-
-
-
Constructor Detail
-
AssocWithThreadResourcePool
public AssocWithThreadResourcePool(PoolInfo poolInfo, Hashtable env) throws PoolingException
- Throws:
PoolingException
-
-
Method Detail
-
initializePoolDataStructure
protected void initializePoolDataStructure() throws PoolingException- Overrides:
initializePoolDataStructurein classConnectionPool- Throws:
PoolingException
-
prefetch
protected ResourceHandle prefetch(ResourceSpec spec, ResourceAllocator alloc, jakarta.transaction.Transaction tran)
Prefetch is called to check whether there there is a free resource is already associated with the thread Only when prefetch is unable to find a resource, normal routine (getUnenlistedResource) will happen.- Overrides:
prefetchin classConnectionPool- Parameters:
spec- ResourceSpecalloc- ResourceAllocatortran- Transaction- Returns:
- ResourceHandle resource associated with the thread, if any
-
initializeResizer
protected Resizer initializeResizer()
- Overrides:
initializeResizerin classConnectionPool
-
isResourceUnused
protected boolean isResourceUnused(ResourceHandle h)
check whether the resource is unused- Overrides:
isResourceUnusedin classConnectionPool- Parameters:
h- ResourceHandle- Returns:
- boolean representing resource usefullness
-
getUnenlistedResource
protected ResourceHandle getUnenlistedResource(ResourceSpec spec, ResourceAllocator alloc, jakarta.transaction.Transaction tran) throws PoolingException
return resource in free list. If none is found, returns null- Overrides:
getUnenlistedResourcein classConnectionPool- Parameters:
spec- ResourceSpecalloc- ResourceAllocatortran- Transaction- Returns:
- ResourceHandle resource from pool
- Throws:
PoolingException- Exception while getting resource from pool
-
freeUnenlistedResource
protected void freeUnenlistedResource(ResourceHandle h)
return the resource back to pool only if it is not associated with the thread.- Overrides:
freeUnenlistedResourcein classConnectionPool- Parameters:
h- ResourceHandle
-
deleteResource
public void deleteResource(ResourceHandle resourceHandle)
destroys the resource- Specified by:
deleteResourcein interfaceResourceHandler- Overrides:
deleteResourcein classConnectionPool- Parameters:
resourceHandle- resource to be destroyed
-
-