Search in sources :

Example 6 with RemoveException

use of javax.ejb.RemoveException in project tomee by apache.

the class CmpContainer method ejbRemove.

private void ejbRemove(final EntityBean entityBean) throws RemoveException {
    if (entityBean == null) {
        throw new NullPointerException("entityBean is null");
    }
    if (isDeleted(entityBean)) {
        return;
    }
    final ThreadContext callContext = createThreadContext(entityBean);
    callContext.setCurrentOperation(Operation.REMOVE);
    final ThreadContext oldCallContext = ThreadContext.enter(callContext);
    try {
        entityBean.ejbRemove();
    } catch (final RemoteException e) {
        throw new EJBException(e);
    } finally {
        // todo replace with interface call when CmpEntityBean interface is added
        try {
            entityBean.getClass().getMethod("OpenEJB_deleted").invoke(entityBean);
        } catch (final Exception ignored) {
        // no-op
        }
        cancelTimers(callContext);
        ThreadContext.exit(oldCallContext);
    }
}
Also used : ThreadContext(org.apache.openejb.core.ThreadContext) RemoteException(java.rmi.RemoteException) OpenEJBException(org.apache.openejb.OpenEJBException) EJBException(javax.ejb.EJBException) ObjectNotFoundException(javax.ejb.ObjectNotFoundException) EJBAccessException(javax.ejb.EJBAccessException) RemoveException(javax.ejb.RemoveException) OpenEJBException(org.apache.openejb.OpenEJBException) InvocationTargetException(java.lang.reflect.InvocationTargetException) RemoteException(java.rmi.RemoteException) EJBException(javax.ejb.EJBException) NoSuchObjectException(java.rmi.NoSuchObjectException) EjbTransactionUtil.handleApplicationException(org.apache.openejb.core.transaction.EjbTransactionUtil.handleApplicationException) EjbTransactionUtil.handleSystemException(org.apache.openejb.core.transaction.EjbTransactionUtil.handleSystemException) ApplicationException(org.apache.openejb.ApplicationException) FinderException(javax.ejb.FinderException)

Aggregations

RemoveException (javax.ejb.RemoveException)6 RemoteException (java.rmi.RemoteException)3 EJBException (javax.ejb.EJBException)3 FinderException (javax.ejb.FinderException)3 ApplicationException (org.apache.openejb.ApplicationException)3 ThreadContext (org.apache.openejb.core.ThreadContext)3 Method (java.lang.reflect.Method)2 NoSuchObjectException (java.rmi.NoSuchObjectException)2 Connection (java.sql.Connection)2 PreparedStatement (java.sql.PreparedStatement)2 EJBHome (javax.ejb.EJBHome)2 EJBLocalHome (javax.ejb.EJBLocalHome)2 SessionBean (javax.ejb.SessionBean)2 InitialContext (javax.naming.InitialContext)2 DataSource (javax.sql.DataSource)2 BeanContext (org.apache.openejb.BeanContext)2 InvalidateReferenceException (org.apache.openejb.InvalidateReferenceException)2 InterceptorData (org.apache.openejb.core.interceptor.InterceptorData)2 InterceptorStack (org.apache.openejb.core.interceptor.InterceptorStack)2 BeanTransactionPolicy (org.apache.openejb.core.transaction.BeanTransactionPolicy)2