Top Description Fields Constructors Methods
net.sf.ehcache.util

public Class CacheTransactionHelper

extends Object
Class Inheritance
Imports
java.lang.reflect.InvocationTargetException, net.sf.ehcache.CacheException, .Ehcache, .TransactionController

A collection of utility methods helping controlling transactions for managed operations which may require them.
Author
Ludovic Orban

Field Summary

Modifier and TypeField and Description
private static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
beginTransactionIfNeeded(Ehcache
the cache to begin a transaction for
cache
)

Begin a transaction on the current thread if the cache is configured as transactional, otherwise this method does nothing.

public static void
commitTransactionIfNeeded(Ehcache
the cache to commit a transaction for
cache
)

Commit a transaction previously begun on the current thread if the cache is configured as transactional, otherwise this method does nothing.

public static boolean

Returns:

true if the cache is transactional and a transaction started, false otherwise
isTransactionStarted
(Ehcache
the cache to check if a transaction started for
cache
)

Check if a transaction has begun on the current thread if the cache is configured as transactional, otherwise always return false.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

XA_STATUS_NO_TRANSACTIONback to summary
private static final int XA_STATUS_NO_TRANSACTION

Constructor Detail

CacheTransactionHelperback to summary
public CacheTransactionHelper()

Method Detail

beginTransactionIfNeededback to summary
public static void beginTransactionIfNeeded(Ehcache cache) throws CacheException

Begin a transaction on the current thread if the cache is configured as transactional, otherwise this method does nothing.

Parameters
cache:Ehcache

the cache to begin a transaction for

Exceptions
CacheException:
if anything wrong happens
commitTransactionIfNeededback to summary
public static void commitTransactionIfNeeded(Ehcache cache) throws CacheException

Commit a transaction previously begun on the current thread if the cache is configured as transactional, otherwise this method does nothing.

Parameters
cache:Ehcache

the cache to commit a transaction for

Exceptions
CacheException:
if anything wrong happens
isTransactionStartedback to summary
public static boolean isTransactionStarted(Ehcache cache) throws CacheException

Check if a transaction has begun on the current thread if the cache is configured as transactional, otherwise always return false.

Parameters
cache:Ehcache

the cache to check if a transaction started for

Returns:boolean

true if the cache is transactional and a transaction started, false otherwise

Exceptions
CacheException:
if anything wrong happens