public static Object runInTransaction(Callable fn) throws Exception { LockingTransaction t = transaction.get(); if (t == null) transaction.set(t = new LockingTransaction()); if (t.info != null) return fn.call(); return t.run(fn); }
public static Object runInTransaction(Callable fn) throws Exception { LockingTransaction t = transaction.get(); Object ret; if (t == null) { transaction.set(t = new LockingTransaction()); try { ret = t.run(fn); } finally { transaction.remove(); } } else { if (t.info != null) { ret = fn.call(); } else { ret = t.run(fn); } } return ret; }