ehcache

net.sf.ehcache.transaction.manager
Class DefaultTransactionManagerLookup

java.lang.Object
  extended by net.sf.ehcache.transaction.manager.DefaultTransactionManagerLookup
All Implemented Interfaces:
TransactionManagerLookup
Direct Known Subclasses:
EhcacheJtaTransactionManagerLookup

public class DefaultTransactionManagerLookup
extends Object
implements TransactionManagerLookup

Default TransactionManagerLookup implementation, that will be used by an initializing Cache should the user have not specified otherwise.

This implementation will:

  1. try lookup an InitialContext;
  2. if successful, lookup a TransactionManager under java:/TransactionManager, this location can be overridden;
  3. if it failed, or couldn't find TransactionManager instance, look for a Bitronix TransactionManager;
  4. and finally an Atomikos one.
To specify under what specific name the TransactionManager is to be found, you can provide a jndiName property using setProperties(java.util.Properties). That can be set in the CacheManager's configuration file. The first TransactionManager instance is then kept and returned on each getTransactionManager() call

Author:
Alex Snaps

Constructor Summary
DefaultTransactionManagerLookup()
           
 
Method Summary
 TransactionManager getTransactionManager()
          Lookup available txnManagers
 void register(EhcacheXAResource resource)
          execute txnManager specific code to register the XAResource for recovery.
 void setProperties(Properties properties)
          Setter to the properties properties.
 void unregister(EhcacheXAResource resource)
          execute txnManager specific code to unregister the XAResource for recovery.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTransactionManagerLookup

public DefaultTransactionManagerLookup()
Method Detail

getTransactionManager

public TransactionManager getTransactionManager()
Lookup available txnManagers

Specified by:
getTransactionManager in interface TransactionManagerLookup
Returns:
TransactionManager

register

public void register(EhcacheXAResource resource)
execute txnManager specific code to register the XAResource for recovery.

Specified by:
register in interface TransactionManagerLookup
Parameters:
resource - the XAResource to register for recovery in the choosen TM.

unregister

public void unregister(EhcacheXAResource resource)
execute txnManager specific code to unregister the XAResource for recovery.

Specified by:
unregister in interface TransactionManagerLookup
Parameters:
resource - the XAResource to register for recovery in the choosen TM.

setProperties

public void setProperties(Properties properties)
Setter to the properties properties. This will be called right after the class has been instantiated.

Specified by:
setProperties in interface TransactionManagerLookup
Parameters:
properties - the properties parsed from the config file's transactionManagerLookup tag's properties attribute

ehcache

true