Class DefaultTransactionManagerLookup
- java.lang.Object
-
- net.sf.ehcache.transaction.manager.DefaultTransactionManagerLookup
-
- All Implemented Interfaces:
TransactionManagerLookup
- Direct Known Subclasses:
EhcacheJtaTransactionManagerLookup
public class DefaultTransactionManagerLookup extends java.lang.Object implements TransactionManagerLookup
DefaultTransactionManagerLookupimplementation, that will be used by aninitializingCache should the user have not specified otherwise.This implementation will:
- lookup a TransactionManager under java:/TransactionManager, this location can be overridden;
- if it failed, lookup for a Glassfish transaction manager;
- if it failed, lookup for a Weblogic transaction manager;
- if it failed, look for a Bitronix TransactionManager;
- and if it failed, finally an Atomikos one.
setProperties(java.util.Properties). That can be set in the CacheManager's configuration file. The first TransactionManager instance is then kept and returned on eachgetTransactionManager()call- Author:
- Alex Snaps
-
-
Constructor Summary
Constructors Constructor Description DefaultTransactionManagerLookup()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.transaction.TransactionManagergetTransactionManager()Lookup available txnManagersvoidinit()Switch the TransactionManagerLookup implementation to its initialized state.voidregister(EhcacheXAResource resource, boolean forRecovery)execute txnManager specific code to register the XAResource for recovery.voidsetProperties(java.util.Properties properties)Setter to the properties properties.voidunregister(EhcacheXAResource resource, boolean forRecovery)execute txnManager specific code to unregister the XAResource for recovery.
-
-
-
Method Detail
-
init
public void init()
Switch the TransactionManagerLookup implementation to its initialized state. All EhcacheXAResources registered before initialization are queued up internally and are only registered with the transaction manager during initialization.- Specified by:
initin interfaceTransactionManagerLookup
-
getTransactionManager
public javax.transaction.TransactionManager getTransactionManager()
Lookup available txnManagers- Specified by:
getTransactionManagerin interfaceTransactionManagerLookup- Returns:
- TransactionManager
-
register
public void register(EhcacheXAResource resource, boolean forRecovery)
execute txnManager specific code to register the XAResource for recovery.- Specified by:
registerin interfaceTransactionManagerLookup- Parameters:
resource- the XAResource to register for recovery in the choosen TM.forRecovery- true if the XAResource is meant to be registered for recovery purpose only.
-
unregister
public void unregister(EhcacheXAResource resource, boolean forRecovery)
execute txnManager specific code to unregister the XAResource for recovery.- Specified by:
unregisterin interfaceTransactionManagerLookup- Parameters:
resource- the XAResource to register for recovery in the choosen TM.forRecovery- true if the XAResource is meant to be registered for recovery purpose only.
-
setProperties
public void setProperties(java.util.Properties properties)
Setter to the properties properties. This will be called right after the class has been instantiated.- Specified by:
setPropertiesin interfaceTransactionManagerLookup- Parameters:
properties- the properties parsed from the config file's transactionManagerLookup tag's properties attribute
-
-