private void afterInvoke(final ThreadContext callContext, final TransactionPolicy txPolicy, final Instance instance) throws OpenEJBException {
try {
unregisterEntityManagers(instance, callContext);
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);