3.15.9 Transaction recovery

This functionality concludes the 2-phase transactions that are in the prepared state or heuristic completion state due to the J2EE server and resource manager errors. This functionality is enabled when you use the global transactions.

When you start a J2EE server, the full transaction recovery processing is executed unconditionally for the imported resources. Also, partial recovery processing is executed even when the resource manager is down during the execution of a transaction.

Note that when you are using the in-process transaction service, you can display the transaction status with the server management command cjlisttrn. Also, you can use the cjlisttrnfile command to display the unconcluded transaction information remaining in the status file of a stopped J2EE server.

When the light transaction is enabled, the transaction recovery functionality is not available.

Note
If the transaction is not recovered due to the restarting of the J2EE server, the user must recover the transaction manually following the recovery procedure for each resource.
Organization of this subsection
(1) Checking the unconcluded transactions and setting up a timeout when the J2EE server is terminated
(2) Notes
(3) Procedure for checking the transaction information

(1) Checking the unconcluded transactions and setting up a timeout when the J2EE server is terminated

When the J2EE server terminates normally, the J2EE server checks if there are any unconcluded transactions and then stops. If unconcluded transactions exist, the J2EE server waits infinitely until the transactions are completed. Also, the resources cannot be deleted until that transaction is concluded.

On the other hand, if a transaction need not be resolved quickly, such as during system development, you can set a timeout value for checking the unconcluded transactions. If a timeout occurs, the stop processing of the J2EE server is executed even if the checking of the unconcluded transactions is not complete. However, set a timeout value for operations such as J2EE application development. To guarantee transaction reliability during the operations of the J2EE applications, we recommend that you do not set a timeout value.

You specify the timeout settings by customizing the J2EE server properties. For details on customizing the settings for the J2EE server operations, see 3.15.13 Settings in the execution environment.

(2) Notes

The notes on transaction recovery are as follows:

(a) Notes when the resource adapter fails to start when you start the J2EE server

When you start the J2EE server, if the resource adapter using the XATransaction fails to start, the J2EE server does not recover the transaction, outputs the message KDJE48605-E, and terminates forcefully. In this case, eliminate the reason due to which the resource adapter failed to start, and then restart the J2EE server. This concludes the prepared or heuristic transactions.

(b) Notes on restarting the J2EE server
(c) Permissions for executing transaction recovery
(d) Number of connections used

Note the number of connections that are used when a transaction is recovered.

With J2EE server, you establish the following connections for one resource adapter that has the transaction support level XATransaction:

The maximum number of connections that the same resource manager requires is the value indicated by the following expression. Take precautions when there is an upper limit to the number of connections for the resource manager.

Maximum number of connections required for the same resource manager = IR(1) + ... + IR(N) + N
IR(i)
Maximum number of connections in the pool settings for the ith resource adapter.
1 <= i <= N.
N
  • For the resource adapters conforming to the Connector 1.0 specifications, the number of resource adapters connected to the same resource manager.
  • For the resource adapters conforming to the Connector 1.5 specifications, total number of connection definitions in the resource adapter connected to the same resource manager.
The target resource adapter is the one that is running and has the transaction support level XATransaction.

(3) Procedure for checking the transaction information

This section describes how to check the transaction information of a running and stopped J2EE server. You can check information such as the state of the transactions in a running J2EE server and the presence or absence of unconcluded transactions in a stopped J2EE server.

(a) Procedure for checking a running transaction

You can check the information for a running transaction on the J2EE server. You can check the information such as the transaction state, global transaction ID, time elapsed, and the branch type.

Use the cjlisttrn command to check a running transaction. The format and example of execution are as follows:

Format of execution

cjlisttrn [server-name] -bqual

Example of execution

cjlisttrn MyServer -bqual

You can also check the state of an unconcluded transaction. To check the information for an unconcluded transaction, specify -pending in the argument. The format and example of execution for checking the information on an unconcluded transaction are as follows:

Format of execution

cjlisttrn [server-name] -pending -bqual

Example of execution

cjlisttrn MyServer -pending -bqual

For details on the cjlisttrn command and the information that can be obtained, see cjlisttrn (Displaying the transaction information of a running J2EE server) in the uCosminexus Application Server Command Reference Guide.

(b) Procedure for checking a stopped transaction

You can check the transaction information of a stopped J2EE server. You can check the information such as the transaction state, global transaction ID, time elapsed, and the branch type. You can also check if any unconcluded transactions are remaining.

Use the cjlisttrnfile command to check a stopped transaction. The format and example of execution are as follows:

Format of execution

cjlisttrnfile [server-name] -bqual

Example of execution

cjlisttrnfile MyServer -bqual

If there are any unconcluded transactions when the J2EE server has stopped, conclude the transaction by executing the following processing as and when required:

For details on the cjlisttrnfile command and the information that can be obtained, see cjlisttrnfile (Displaying the transaction information of a stopped J2EE server) in the uCosminexus Application Server Command Reference Guide.