NonStop Server for Java 7.0 Programmer's Reference

6 Transactions
NSJ7 allows you work with transactions in the following ways:
Use the Current class methods to define transactions across transaction services, such as
transactions that include JDBC calls.
Use the Java Transaction API (JTA).
This section explains the following topics:
“Controlling maximum concurrent transactions” (page 82)
Current Class methods” (page 82)
“Java transaction API” (page 83)
If you use JNI and transactions, see “Java native interface (JNI)” (page 35). When you use JNI,
the information available in “Controlling maximum concurrent transactions” (page 82) applies.
Controlling maximum concurrent transactions
NSJ7 application processes, by default, can start a maximum of 200 concurrent transactions in
each process. By setting the JAVA_PTHREAD_MAX_TRANSACTIONS environment variable, you
can control the maximum number of TMF transactions allowed per process to less than 1000. The
following is the syntax to set the maximum transactions allowed per process:
JAVA_PTHREAD_MAX_TRANSACTIONS environment variable
Specifies the maximum number of TMF transactions allowed per process.
Permissible values are 100 through 1000. The default value of 200 is used when the variable is:
Not set.
Set to a value less than 100 or to a value greater than 1000.
For example, to specify 200 transactions per process, use the following command:
export JAVA_PTHREAD_MAX_TRANSACTIONS=200
Current Class methods
The Current class is based on version 0.5 of the Java Transaction Services (JTS) specification.
Table 13 (page 82) describes the Current class methods.
Table 13 Current Class methods
DescriptionMethod
Starts a new transaction and associates it with the calling thread.begin
Commits the transaction associated with the calling thread.commit
Gets a Control object representing the transaction associated with the
calling thread.
get_control
Gets the status of the transaction associated with the calling thread.get_status
Gets a descriptive name of the transaction associated with the calling thread.get_transaction_name
Sets or resumes association of a transaction with the calling thread.resume
Rolls back the transaction associated with the calling thread.rollback
Marks the transaction associated with the calling thread so that the only
possible outcome is to roll back the transaction.
rollback_only
82 Transactions