Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Enterprise JavaBeans™ Specification, Version 2.0 - Sun Microsystems.pdf
Скачиваний:
14
Добавлен:
24.05.2014
Размер:
2.71 Mб
Скачать

Sun Microsystems Inc.

Support for Distribution and Interoperability

Enterprise JavaBeans 2.0, Public Draft

Transaction interoperability

18.5.1.4 Exception handling behavior

The exception handling behavior described in the Messaging Service’s extensions to OTS must be followed. In addition, if an application exception (an exception which is not a CORBA system exception and does not extend java.rmi.RemoteException) was returned by the server, the request is defined as being successful, hence the client-side OTS library must not roll back the transaction. This allows application exceptions to be propagated back to the client without rolling back the transaction, as required by the exception handling rules in Chapter 17.

18.5.2 Interoperating with containers that do not implement transaction interoperability

The requirements in this subsection are designed to ensure that when a J2EE container does not support transaction interoperability, the failure modes are well defined so that the integrity of an application’s data is not compromised: at worst the transaction is rolled back. When a J2EE client component expects the client’s transaction to propagate to the enterprise bean but the client or EJB container cannot satisfy this expectation, a java.rmi.RemoteException or subclass is thrown which ensures that the client’s transaction will roll back.

In addition, the requirements below allow a container that does not support transaction propagation to interoperate with a container that does support transaction propagation in the cases where the enterprise bean method’s transaction attribute indicates that the method would not be executed in the client’s transaction.

18.5.2.1 Client container requirements

If the client in another container invokes an enterprise bean’s method when there is no active global transaction associated with the client’s thread, or if the bean’s IOR indicates that its transaction policy is Allows_none, the client container does not include a transaction context in the IIOP request message to the EJB server, i.e. there is no CosTransactions::PropagationContext structure in the IIOP request header.

The client application component expects a global transaction to be propagated to the server only if the target bean’s reference indicates a transaction policy of Allows_shared or Requires_shared and the client’s thread has an active global transaction. In this scenario, if the client container does not support transaction interoperability, it has two options:

1.If the client container does not support transaction propagation or uses a non-OTS protocol, it must include the OTS CosTransactions::PropagationContext structure in the IIOP request to the server (step 1 in the object interaction diagram above), with the CosTransactions::Coordinator and CosTransactions::Terminator object references as null. The remaining fields in this “null transaction context” such as the transaction identifier are not interpreted and may have any value. The “null transaction context” indicates that there is a global client transaction active but the client container is not capable of propagating it to the server. The presence of this “null transaction context” allows the EJB container to determine whether the J2EE client component expects the client’s global transaction to propagate to the server.

5/31/00

368