Package bitronix.tm.resource.common
Interface XAResourceProducer
- All Superinterfaces:
Referenceable,Serializable
- All Known Implementing Classes:
EhCacheXAResourceProducer,PoolingConnectionFactory,PoolingConnectionFactory,PoolingDataSource
A
XAResourceProducer is a XAStatefulHolder factory. It must be implemented by any class that is
able to produce pooled XA connections.- Author:
- lorban
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Release thisXAResourceProducer's internal resources.createPooledConnection(Object xaFactory, ResourceBean bean) Create aXAStatefulHolderthat will be placed in anXAPool.voidRelease internal resources held after call tostartRecovery().findXAResourceHolder(XAResource xaResource) Find in theXAResourceHolders created by thisXAResourceProducerthe one which thisXAResourcebelongs to.Get the resource name as registered in the transactions journal.voidinit()Initialize thisXAResourceProducer's internal resources.voidsetFailed(boolean failed) Mark this resource producer as failed or not.Prepare the recoverableXAResourceproducer for recovery.Methods inherited from interface javax.naming.Referenceable
getReference
-
Method Details
-
getUniqueName
String getUniqueName()Get the resource name as registered in the transactions journal.- Returns:
- the unique name of the resource.
-
startRecovery
Prepare the recoverableXAResourceproducer for recovery.- Returns:
- a
XAResourceHolderStateobject that can be used to callrecover(). - Throws:
RecoveryException- thrown when aXAResourceHolderStatecannot be acquired.
-
endRecovery
Release internal resources held after call tostartRecovery().- Throws:
RecoveryException- thrown when an error occured while releasing reserved resources.
-
setFailed
void setFailed(boolean failed) Mark this resource producer as failed or not. A resource is considered failed if recovery fails to run on it.- Parameters:
failed- true is the resource must be considered failed, false it it must be considered sane.
-
findXAResourceHolder
Find in theXAResourceHolders created by thisXAResourceProducerthe one which thisXAResourcebelongs to.- Parameters:
xaResource- theXAResourceto look for.- Returns:
- the associated
XAResourceHolderor null if theXAResourcedoes not belong to thisXAResourceProducer.
-
init
void init()Initialize thisXAResourceProducer's internal resources. -
close
void close()Release thisXAResourceProducer's internal resources. -
createPooledConnection
Create aXAStatefulHolderthat will be placed in anXAPool.- Parameters:
xaFactory- the vendor's resource-specific XA factory.bean- the resource-specific bean describing the resource parameters.- Returns:
- a
XAStatefulHolderthat will be placed in anXAPool. - Throws:
Exception- thrown when theXAStatefulHoldercannot be created.
-