if (this.isApplicationException(statefulComponent, e.getClass(), context.getMethod()) && this.retainIfException) {
throw e;
}
// otherwise, just remove it and throw back the original exception
final StatefulSessionComponentInstance statefulComponentInstance = (StatefulSessionComponentInstance) context.getPrivateData(ComponentInstance.class);
final SessionID sessionId = statefulComponentInstance.getId();
statefulComponent.removeSession(sessionId);
throw e;
}
final StatefulSessionComponentInstance statefulComponentInstance = (StatefulSessionComponentInstance) context.getPrivateData(ComponentInstance.class);
final SessionID sessionId = statefulComponentInstance.getId();
// just remove the session because of a call to @Remove method
statefulComponent.removeSession(sessionId);
// return the invocation result
return invocationResult;
}