2.5. Implicit Transaction Propagation and Interposition
You can create transactions within one domain and use them within another. Therefore, information about a transaction, called the transaction context, needs to be propagated between these domains.
Propagating the Transaction Context
- Explicit propagation
- An application passes context objects as explicit parameters. These objects are either instances of the
Control
interface or thePropagationContext
structure, and are defined by the Transaction Service. It is more efficient to use thePropagationContext
structure, rather than theControl
interface. - Implicit propagation
- Requests on objects are implicitly associated with the client’s transaction, and share the client’s transaction context. The context is transmitted implicitly to the objects, without direct client intervention.
OTS objects supporting the Control interface are standard CORBA objects. When the interface is passed as a parameter in an operation call to a remote server, only an object reference is passed. Any operations that the remote object performs on the interface are performed on the real object.
This behavior can impose substantial penalties on an application which frequently uses these interfaces due to the overheads of remote invocation. To avoid this overhead, JBoss Transaction Service supports interposition. In interposition, the server creates a local object which acts as a proxy for the remote transaction, fielding all requests that would normally be passed back to the originator. This local object registers itself with the original transaction coordinator, so that it can correctly participate in the termination of the transaction. Interposed coordinators effectively form a tree structure with their parent coordinators, as shown in Figure 2.1, “Interposition”.
Figure 2.1. Interposition
Note
implicit transaction propagation does not imply that interposition is also used at the server. Instead, interposition typically requires implicit propagation.
If you require implicit context propagation and interposition, ensure that JBoss Transaction Service is correctly initialized before creating any objects. The client and server need to agree whether implicit propagation or interposition, or neither, is used. Implicit context propagation is only possible on those ORBs which support filters and interceptors, or which support the
CosTSPortability
interface. JacORB and the JDK miniORB both provide the required support.
Enabling Propagation
- Implicit context propagation
- Set the com.arjuna.ats.jts.contextPropMode property variable to
CONTEXT
. - Interposition
- Set the com.arjuna.ats.jts.contextPropMode property variable to
INTERPOSITION
.
Note
To use the JBoss Transaction Service advanced API, you must use interposition.