org.openejb.core.stateless
Class StatelessBeanManagedTxPolicy
java.lang.Object
|
+--org.openejb.core.transaction.TransactionPolicy
|
+--org.openejb.core.stateless.StatelessBeanManagedTxPolicy
- public class StatelessBeanManagedTxPolicy
- extends TransactionPolicy
Transaction policy for Stateless Session beans with
bean-managed transaction demarcation.
- Version:
- $Revision: 1.1 $ $Date: 2002/01/21 08:09:03 $
Method Summary |
void |
afterInvoke(javax.ejb.EnterpriseBean instance,
TransactionContext context)
If a stateless session bean instance starts a transaction in a business
method, it must commit the transaction before the business method returns. |
void |
beforeInvoke(javax.ejb.EnterpriseBean instance,
TransactionContext context)
When a client invokes a business method via the enterprise bean’s home
or component interface, the Container suspends any transaction that may be
associated with the client request. |
void |
handleApplicationException(java.lang.Throwable appException,
TransactionContext context)
Container's action
|
void |
handleSystemException(java.lang.Throwable sysException,
javax.ejb.EnterpriseBean instance,
TransactionContext context)
A system exception is any exception that is not an Application Exception. |
Methods inherited from class org.openejb.core.transaction.TransactionPolicy |
beginTransaction, commitTransaction, discardBeanInstance, getContainer, getTxMngr, handleCallbackException, logSystemException, markTxRollbackOnly, rollbackTransaction, throwAppExceptionToServer, throwExceptionToServer, throwTxExceptionToServer |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StatelessBeanManagedTxPolicy
public StatelessBeanManagedTxPolicy(TransactionContainer container)
StatelessBeanManagedTxPolicy
public StatelessBeanManagedTxPolicy()
beforeInvoke
public void beforeInvoke(javax.ejb.EnterpriseBean instance,
TransactionContext context)
throws SystemException,
ApplicationException
- When a client invokes a business method via the enterprise bean’s home
or component interface, the Container suspends any transaction that may be
associated with the client request.
- Overrides:
beforeInvoke
in class TransactionPolicy
- Parameters:
instance
- context
- - Throws:
SystemException
- ApplicationException
-
afterInvoke
public void afterInvoke(javax.ejb.EnterpriseBean instance,
TransactionContext context)
throws ApplicationException,
SystemException
- If a stateless session bean instance starts a transaction in a business
method, it must commit the transaction before the business method returns.
The Container must detect the case in which a transaction was started, but
not completed, in the business method, and handle it as follows:
• Log this as an application error to alert the system administrator.
• Roll back the started transaction.
• Discard the instance of the session bean.
• Throw the java.rmi.RemoteException to the client if the client is a
remote client, or throw the javax.ejb.EJBException if the client is a
local client.
- Overrides:
afterInvoke
in class TransactionPolicy
- Parameters:
instance
- context
- - Throws:
ApplicationException
- SystemException
-
handleApplicationException
public void handleApplicationException(java.lang.Throwable appException,
TransactionContext context)
throws ApplicationException
- Container's action
Re-throw AppException
Client's view
Client receives AppException.
- Overrides:
handleApplicationException
in class TransactionPolicy
handleSystemException
public void handleSystemException(java.lang.Throwable sysException,
javax.ejb.EnterpriseBean instance,
TransactionContext context)
throws ApplicationException,
SystemException
- A system exception is any exception that is not an Application Exception.
Container's action
-
Log the exception or error so that the System Administrator is alerted of
the problem.
-
Mark for rollback a transaction that has been started, but not yet
completed, by the instance.
-
Discard instance. The Container must not invoke any business methods or
container callbacks on the instance.
-
Throw RemoteException to remote client; throw EJBException to local client.
Client's view
Receives RemoteException or EJBException.
- Overrides:
handleSystemException
in class TransactionPolicy