Package com.sun.enterprise.resource
Class ResourceHandle
- java.lang.Object
-
- com.sun.enterprise.resource.ResourceHandle
-
- All Implemented Interfaces:
ResourceHandle,TransactionalResource
- Direct Known Subclasses:
AssocWithThreadResourceHandle
public class ResourceHandle extends Object implements ResourceHandle, TransactionalResource
ResourceHandle encapsulates a resource connection. Equality on the handle is based on the id field- Author:
- Tony Ng
-
-
Constructor Summary
Constructors Constructor Description ResourceHandle(Object resource, ResourceSpec spec, ResourceAllocator alloc, ClientSecurityInfo info)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseUserConnection()voiddecrementCount()voiddestroyResource()voidenlistedInTransaction(jakarta.transaction.Transaction tran)Indicates that a resource has been enlisted in the transaction.booleanequals(Object other)voidfillInResourceObjects(Object userConnection, XAResource xaRes)ClientSecurityInfogetClientSecurityInfo()ObjectgetComponentInstance()longgetId()longgetLastValidated()jakarta.resource.spi.ConnectionEventListenergetListener()StringgetName()intgetPartition()ObjectgetResource()ResourceAllocatorgetResourceAllocator()ResourceSpecgetResourceSpec()ResourceStategetResourceState()intgetShareCount()SubjectgetSubject()intgetUsageCount()ObjectgetUserConnection()XAResourcegetXAResource()booleanhasConnectionErrorOccurred()inthashCode()voidincrementCount()voidincrementUsageCount()booleanisBusy()booleanisEnlisted()booleanisEnlistmentSuspended()To check whether lazy enlistment is suspended or not.
If true, TM will not do enlist/lazy enlist.booleanisMarkedForReclaim()To check if the resourceHandle is marked for leak reclaim or not.booleanisShareable()booleanisTransactional()Does this resource need enlistment to transaction manager?voidmarkForReclaim(boolean reclaim)voidsetBusy(boolean isBusy)voidsetComponentInstance(Object instance)voidsetConnectionErrorOccurred()voidsetEnlistmentSuspended(boolean enlistmentSuspended)voidsetLastValidated(long lastValidated)voidsetListener(jakarta.resource.spi.ConnectionEventListener l)voidsetPartition(int partition)voidsetResourceSpec(ResourceSpec spec)voidsetResourceState(ResourceState state)voidsetSubject(Subject subject)booleansupportsLazyAssociation()booleansupportsLazyEnlistment()booleansupportsXA()StringtoString()
-
-
-
Field Detail
-
lock
public final Object lock
-
-
Constructor Detail
-
ResourceHandle
public ResourceHandle(Object resource, ResourceSpec spec, ResourceAllocator alloc, ClientSecurityInfo info)
-
-
Method Detail
-
isTransactional
public boolean isTransactional()
Does this resource need enlistment to transaction manager?- Specified by:
isTransactionalin interfaceResourceHandle- Specified by:
isTransactionalin interfaceTransactionalResource
-
isEnlistmentSuspended
public boolean isEnlistmentSuspended()
To check whether lazy enlistment is suspended or not.
If true, TM will not do enlist/lazy enlist.- Specified by:
isEnlistmentSuspendedin interfaceResourceHandle- Specified by:
isEnlistmentSuspendedin interfaceTransactionalResource- Returns:
- boolean
-
setEnlistmentSuspended
public void setEnlistmentSuspended(boolean enlistmentSuspended)
- Specified by:
setEnlistmentSuspendedin interfaceResourceHandle
-
markForReclaim
public void markForReclaim(boolean reclaim)
-
isMarkedForReclaim
public boolean isMarkedForReclaim()
To check if the resourceHandle is marked for leak reclaim or not.- Returns:
- boolean
-
supportsXA
public boolean supportsXA()
- Specified by:
supportsXAin interfaceResourceHandle- Specified by:
supportsXAin interfaceTransactionalResource
-
getResourceAllocator
public ResourceAllocator getResourceAllocator()
-
getResource
public Object getResource()
-
getClientSecurityInfo
public ClientSecurityInfo getClientSecurityInfo()
-
setResourceSpec
public void setResourceSpec(ResourceSpec spec)
-
getResourceSpec
public ResourceSpec getResourceSpec()
-
getXAResource
public XAResource getXAResource()
- Specified by:
getXAResourcein interfaceResourceHandle- Specified by:
getXAResourcein interfaceTransactionalResource
-
getUserConnection
public Object getUserConnection()
-
setComponentInstance
public void setComponentInstance(Object instance)
- Specified by:
setComponentInstancein interfaceResourceHandle- Specified by:
setComponentInstancein interfaceTransactionalResource
-
closeUserConnection
public void closeUserConnection() throws PoolingException- Specified by:
closeUserConnectionin interfaceResourceHandle- Specified by:
closeUserConnectionin interfaceTransactionalResource- Throws:
PoolingException
-
getComponentInstance
public Object getComponentInstance()
- Specified by:
getComponentInstancein interfaceResourceHandle- Specified by:
getComponentInstancein interfaceTransactionalResource
-
getId
public long getId()
-
fillInResourceObjects
public void fillInResourceObjects(Object userConnection, XAResource xaRes)
-
incrementCount
public void incrementCount()
-
decrementCount
public void decrementCount()
-
getShareCount
public int getShareCount()
-
setSubject
public void setSubject(Subject subject)
-
getSubject
public Subject getSubject()
-
setConnectionErrorOccurred
public void setConnectionErrorOccurred()
-
hasConnectionErrorOccurred
public boolean hasConnectionErrorOccurred()
-
setResourceState
public void setResourceState(ResourceState state)
-
getResourceState
public ResourceState getResourceState()
-
setListener
public void setListener(jakarta.resource.spi.ConnectionEventListener l)
-
getListener
public jakarta.resource.spi.ConnectionEventListener getListener()
-
isShareable
public boolean isShareable()
- Specified by:
isShareablein interfaceResourceHandle- Specified by:
isShareablein interfaceTransactionalResource
-
destroyResource
public void destroyResource()
- Specified by:
destroyResourcein interfaceResourceHandle- Specified by:
destroyResourcein interfaceTransactionalResource
-
isEnlisted
public boolean isEnlisted()
- Specified by:
isEnlistedin interfaceResourceHandle- Specified by:
isEnlistedin interfaceTransactionalResource
-
getLastValidated
public long getLastValidated()
-
setLastValidated
public void setLastValidated(long lastValidated)
-
getUsageCount
public int getUsageCount()
-
incrementUsageCount
public void incrementUsageCount()
-
getPartition
public int getPartition()
-
setPartition
public void setPartition(int partition)
-
getName
public String getName()
- Specified by:
getNamein interfaceTransactionalResource- Returns:
- the String that can identify this resource
-
supportsLazyEnlistment
public boolean supportsLazyEnlistment()
-
supportsLazyAssociation
public boolean supportsLazyAssociation()
-
enlistedInTransaction
public void enlistedInTransaction(jakarta.transaction.Transaction tran) throws IllegalStateExceptionDescription copied from interface:TransactionalResourceIndicates that a resource has been enlisted in the transaction.- Specified by:
enlistedInTransactionin interfaceTransactionalResource- Parameters:
tran- Transaction to which the resource is enlisted- Throws:
IllegalStateException- when unable to enlist the resource
-
setBusy
public void setBusy(boolean isBusy)
-
isBusy
public boolean isBusy()
-
-