Example #1
0
 public static boolean hasTransaction(final Object obj) {
   final String ctx = lookatPersistenceContext(obj);
   final CascadingTx tx = txStateThreadLocal.get().get(ctx);
   if (tx == null) {
     return false;
   } else if (tx.isActive()) {
     return true;
   } else {
     cleanStrandedTx(tx);
     return false;
   }
 }
Example #2
0
 private boolean clearStale(final PersistenceContext persistenceContext) {
   final CascadingTx tx = this.get().get(persistenceContext.name());
   if (!tx.isActive()) {
     try {
       tx.getTxState().doCleanup();
     } catch (final Exception ex) {
       LOG.error(ex, ex);
     } finally {
       this.get().remove(persistenceContext.name());
     }
     return true;
   } else {
     return false;
   }
 }