public Object handleInvocation(Invocation invocation) throws Throwable { assert tm.getTransaction() == null : "can't handle BMT transaction, there is a transaction active"; String ejbName = invocation.getAdvisor().getName(); boolean exceptionThrown = false; try { return invocation.invokeNext(); } catch (Exception ex) { exceptionThrown = true; checkStatelessDone(invocation, ejbName, ex); throw ex; } finally { try { if (!exceptionThrown) checkStatelessDone(invocation, ejbName, null); } finally { tm.suspend(); } } }
this.handleException(invocation, ex);
public Object createPerJoinpoint(Advisor advisor, Joinpoint jp) { // We have to do this until AOP supports matching based on annotation attributes TransactionManagementType type = TxUtil.getTransactionManagementType(advisor); if (type != TransactionManagementType.BEAN) return new NullInterceptor(); TransactionManager tm = TxUtil.getTransactionManager(); boolean stateful = advisor.resolveAnnotation(Stateful.class) != null; // Both MessageDriven and Stateless are stateless if(stateful) return new StatefulBMTInterceptor(tm); else return new StatelessBMTInterceptor(tm); } }