Package bitronix.tm.resource.ehcache
Class EhCacheXAResourceProducer
java.lang.Object
bitronix.tm.resource.common.ResourceBean
bitronix.tm.resource.ehcache.EhCacheXAResourceProducer
- All Implemented Interfaces:
XAResourceProducer,Serializable,Referenceable
EHCache implementation of BTM's XAResourceProducer.
Copyright 2003-2010 Terracotta, Inc.
- Author:
- lorban
- See Also:
-
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.voidinit()Initialize thisXAResourceProducer's internal resources.static voidregisterXAResource(String uniqueName, XAResource xaResource) Register an XAResource of a cache with BTM.voidsetFailed(boolean failed) Mark this resource producer as failed or not.Prepare the recoverableXAResourceproducer for recovery.toString()static voidunregisterXAResource(String uniqueName, XAResource xaResource) Unregister an XAResource of a cache from BTM.Methods inherited from class bitronix.tm.resource.common.ResourceBean
getAcquireIncrement, getAcquisitionInterval, getAcquisitionTimeout, getAllowLocalTransactions, getApplyTransactionTimeout, getAutomaticEnlistingEnabled, getClassName, getDeferConnectionRelease, getDriverProperties, getIgnoreRecoveryFailures, getMaxIdleTime, getMaxPoolSize, getMinPoolSize, getShareTransactionConnections, getTwoPcOrderingPosition, getUniqueName, getUseTmJoin, incCreatedResourcesCounter, isDisabled, setAcquireIncrement, setAcquisitionInterval, setAcquisitionTimeout, setAllowLocalTransactions, setApplyTransactionTimeout, setAutomaticEnlistingEnabled, setClassName, setDeferConnectionRelease, setDisabled, setDriverProperties, setIgnoreRecoveryFailures, setMaxIdleTime, setMaxPoolSize, setMinPoolSize, setShareTransactionConnections, setTwoPcOrderingPosition, setUniqueName, setUseTmJoinMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface bitronix.tm.resource.common.XAResourceProducer
getUniqueName
-
Method Details
-
registerXAResource
Register an XAResource of a cache with BTM. The first time a XAResource is registered a new EhCacheXAResourceProducer is created to hold it.- Parameters:
uniqueName- the uniqueName of this XAResourceProducer, usually the cache's namexaResource- the XAResource to be registered
-
unregisterXAResource
Unregister an XAResource of a cache from BTM.- Parameters:
uniqueName- the uniqueName of this XAResourceProducer, usually the cache's namexaResource- the XAResource to be registered
-
startRecovery
Prepare the recoverableXAResourceproducer for recovery.- Specified by:
startRecoveryin interfaceXAResourceProducer- Returns:
- a
XAResourceHolderStateobject that can be used to callrecover(). - Throws:
RecoveryException- thrown when aXAResourceHolderStatecannot be acquired.
-
endRecovery
Release internal resources held after call tostartRecovery().- Specified by:
endRecoveryin interfaceXAResourceProducer- Throws:
RecoveryException- thrown when an error occured while releasing reserved resources.
-
setFailed
public void setFailed(boolean failed) Mark this resource producer as failed or not. A resource is considered failed if recovery fails to run on it.- Specified by:
setFailedin interfaceXAResourceProducer- 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.- Specified by:
findXAResourceHolderin interfaceXAResourceProducer- Parameters:
xaResource- theXAResourceto look for.- Returns:
- the associated
XAResourceHolderor null if theXAResourcedoes not belong to thisXAResourceProducer.
-
init
public void init()Initialize thisXAResourceProducer's internal resources.- Specified by:
initin interfaceXAResourceProducer
-
close
public void close()Release thisXAResourceProducer's internal resources.- Specified by:
closein interfaceXAResourceProducer
-
createPooledConnection
public XAStatefulHolder createPooledConnection(Object xaFactory, ResourceBean bean) throws Exception Create aXAStatefulHolderthat will be placed in anXAPool.- Specified by:
createPooledConnectionin interfaceXAResourceProducer- 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.
-
getReference
- Specified by:
getReferencein interfaceReferenceable- Throws:
NamingException
-
toString
-