Object rtn = null;
try
{
rtn = invocation.invokeNext();
}
catch (Throwable t)
{
// don't remove if we're an applicationexception and retain is true
if (TxUtil.getApplicationException(t.getClass(), invocation) != null && retainIfException) throw t;
// otherwise, just remove it.
removeSession(invocation, true);
throw t;
}
removeSession(invocation, false);
return rtn;