use of org.apache.openejb.core.transaction.BeanTransactionPolicy in project tomee by apache.
the class StatefulContainer method afterInvoke.
private void afterInvoke(final ThreadContext callContext, final TransactionPolicy txPolicy, final Instance instance) throws OpenEJBException {
try {
if (instance != null && txPolicy instanceof BeanTransactionPolicy) {
// suspend the currently running transaction if any
SuspendedTransaction suspendedTransaction = null;
try {
final BeanTransactionPolicy beanTxEnv = (BeanTransactionPolicy) txPolicy;
suspendedTransaction = beanTxEnv.suspendUserTransaction();
} catch (final SystemException e) {
EjbTransactionUtil.handleSystemException(txPolicy, e, callContext);
} finally {
instance.setBeanTransaction(suspendedTransaction);
}
}
} finally {
if (instance != null) {
instance.setInUse(false);
}
EjbTransactionUtil.afterInvoke(txPolicy, callContext);
if (instance != null) {
instance.releaseLock();
}
}
}
Aggregations