org.openejb.core.stateful
Class StatefulBeanManagedTxPolicy
java.lang.Object
|
+--org.openejb.core.transaction.TransactionPolicy
|
+--org.openejb.core.stateful.StatefulBeanManagedTxPolicy
- public class StatefulBeanManagedTxPolicy
- extends TransactionPolicy
- Version:
- $Revision: 1.1 $ $Date: 2002/01/21 08:09:03 $
Method Summary |
void |
afterInvoke(javax.ejb.EnterpriseBean instance,
TransactionContext context)
In the case of a stateful session bean, it is possible that the business
method that started a transaction completes without committing or rolling
back the transaction. |
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. |
protected void |
throwExceptionToServer(java.lang.Throwable sysException)
Throw RemoteException to remote client; throw EJBException to local client. |
protected void |
throwTxExceptionToServer(java.lang.Throwable sysException)
|
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
statefulContainer
protected StatefulContainer statefulContainer
StatefulBeanManagedTxPolicy
public StatefulBeanManagedTxPolicy(TransactionContainer container)
StatefulBeanManagedTxPolicy
public StatefulBeanManagedTxPolicy()
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. If there is a transaction associated
with the instance (this would happen if the instance started the
transaction in some previous business method), the Container associates the
method execution with this transaction.
The Container must make the javax.transaction.UserTransaction interface
available to the enterprise bean's business method or onMessage method via
the javax.ejb.EJBContext interface and under the environment entry
java:comp/UserTransaction.
When an instance uses the javax.transaction.UserTransaction interface to
demarcate a transaction, the Container must enlist all the resource managers
used by the instance between the begin() and commit() or rollback() methods
with the transaction.
When the instance attempts to commit the transaction, the Container is
responsible for the global coordination of the transaction commit.
- Overrides:
beforeInvoke
in class TransactionPolicy
- Parameters:
instance
- context
- - Throws:
SystemException
- ApplicationException
-
afterInvoke
public void afterInvoke(javax.ejb.EnterpriseBean instance,
TransactionContext context)
throws ApplicationException,
SystemException
- In the case of a stateful session bean, it is possible that the business
method that started a transaction completes without committing or rolling
back the transaction. In such a case, the Container must retain the
association between the transaction and the instance across multiple client
calls until the instance commits or rolls back the transaction.
When the client invokes the next business method, the Container must invoke
the business method in this transaction context.
- 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
throwExceptionToServer
protected void throwExceptionToServer(java.lang.Throwable sysException)
throws ApplicationException
- Description copied from class:
TransactionPolicy
- Throw RemoteException to remote client; throw EJBException to local client.
- Overrides:
throwExceptionToServer
in class TransactionPolicy
- Following copied from class:
org.openejb.core.transaction.TransactionPolicy
- Parameters:
sysException
- - Throws:
ApplicationException
-
throwTxExceptionToServer
protected void throwTxExceptionToServer(java.lang.Throwable sysException)
throws ApplicationException
- Overrides:
throwTxExceptionToServer
in class TransactionPolicy