private static void cleanStrandedTx(final CascadingTx txValue) { LOG.error( "Found stranded transaction: " + txValue.getRecord().getPersistenceContext() + " started at: " + txValue.getRecord().getStack()); try { txValue.rollback(); } catch (final Exception ex) { LOG.trace(ex, ex); } }
public static void removeTransaction(final CascadingTx tx) { final String txId = makeTxRootName(tx); txLog.remove(txStateThreadLocal.toString() + tx.getRecord().getPersistenceContext()); txStateThreadLocal.get().remove(tx.getRecord().getPersistenceContext()); if (txId.equals(txStateThreadLocal.get())) { for (final Entry<String, CascadingTx> e : txStateThreadLocal.get().entrySet()) { cleanStrandedTx(e.getValue()); } txStateThreadLocal.get().clear(); txStateThreadLocal.remove(); } }
private static String makeTxRootName(final CascadingTx tx) { return txStateThreadLocal.toString() + tx.getRecord().getPersistenceContext(); }