*/
public static boolean isTransactionStarted(Ehcache cache) throws CacheException {
try {
switch (cache.getCacheConfiguration().getTransactionalMode()) {
case LOCAL:
TransactionController ctrl = cache.getCacheManager().getTransactionController();
return ctrl.getCurrentTransactionContext() != null;
case XA:
case XA_STRICT:
Object tm = ((net.sf.ehcache.Cache) cache).getTransactionManagerLookup().getTransactionManager();
return ((Integer) tm.getClass().getMethod("getStatus").invoke(tm)) != XA_STATUS_NO_TRANSACTION;