How it works, Examples for transaction management, How it works examples for transaction management – HP Integrity NonStop H-Series User Manual

Page 69

Advertising
background image

propagated to the TS/MP serverclasses. As a result, the TS/MP serverclass becomes a part
of the JTA transaction context.

The state of the TMF transaction remains the same as that of the XA transaction. For example,
whenever an XA transaction is rolled back, the corresponding TMF transaction gets rolled
back too.

NOTE:

NSASJ can run in 64-bit mode from AAC SPR. 64-bit mode can be selected either during

installation or by changing the JAVA_MODE variable in $NSASJ_HOME/config.prop to
JAVA_MODE=64bit

. Default mode of operation is 32 (JAVA_MODE=32bit). Ensure 64-bit XARM

libraries are available when switching from 32-bit to 64-bit mode.

How it works

NonStop offers a product called XARM (XA Resource Manager) which is an XA compliant resource
manager for TMF. Essentially XARM makes TMF available as an XAResource
(javax.transaction.xa.XAResource). In NSASJ, the TMF XAResource gets enlisted with
the transaction manager under the following two conditions:

When NSASJ acts as a transaction coordinator. For example, the container becomes the
coordinator when it begins a transaction. This happens when an EJB with the transaction
annotation of REQUIRES_NEW is invoked.

NOTE:

There are other conditions too when the container begins a transaction.

When NSASJ participates in a transaction branch. NSASJ acts a participant when for instance
an EJB is invoked in a transaction context and the transaction is started by the EJB client
residing outside the container.

Hence, in case of NSASJ, irrespective of the nature of the application, XARM always gets enlisted
as an XAResource. Once the XAResource gets enlisted, the transaction manager invokes the
XAResource

methods at appropriate instances.

Table 20 (page 69)

lists the methods defined in XAResource and their relevance with TMF.

Table 20 Methods defined in XAResource and their relevance with TMF

Description

Method

A new TMF transaction is started and the calling thread (java thread) is put in
the TMF transaction context. This method is invoked when an XA transaction
is started.

start (flags = TMNOFLAGS)

The calling thread is put in the TMF transaction context that is associated with
the Xid. This method is called when a transaction is resumed.

start (flags = TMJOIN)

If the calling thread is in a TMF transaction context that was started by an
invocation to start method, then the calling thread is removed of the TMF context.
This method is invoked when the transaction is suspended.

end (flags = TMSUCCESS)

The TMF transaction associated with the Xid is committed and the calling
thread is removed of the TMF transaction context. This method is invoked when

commit

the transaction is committed. When XARM is participating in a two phase
commit (2pc) protocol, then this method is invoked after a successful prepare.

The examples in the next section describe scenarios where the NSASJ transaction manager can
be used.

Examples for transaction management

This section discusses the various NonStop specific examples. These use cases are designed keeping
in mind that you understand the concepts like JTA, transactions and XA resources.

Use Case 1: A Pathsend call inside a session bean

Transaction management

69

Advertising
This manual is related to the following products: