Red Hat Training

A Red Hat training course is available for Red Hat JBoss Enterprise Application Platform

19.2. Transaction Administration

19.2.1. Browse and Manage Transactions

The Management CLI supports the ability to browse and manipulate transaction records. This functionality is provided by the interaction between the Transaction Manager and the management API of JBoss EAP 6.
The Transaction Manager stores information about each pending transaction and the participants involved the transaction, in a persistent storage called the object store. The management API exposes the object store as a resource called the log-store. An API operation called probe reads the transaction logs and creates a node for each log. You can call the probe command manually, whenever you need to refresh the log-store. It is normal for transaction logs to appear and disappear quickly.

Example 19.1. Refresh the Log Store

This command refreshes the log store for server groups which use the profile default in a managed domain. For a standalone server, remove the profile=default from the command.

Example 19.2. View All Prepared Transactions

To view all prepared transactions, first refresh the log store (see Example 19.1, “Refresh the Log Store”), then run the following command, which functions similarly to a filesystem ls command.
ls /profile=default/subsystem=transactions/log-store=log-store/transactions
Each transaction is shown, along with its unique identifier. Individual operations can be run against an individual transaction (see Manage a Transaction).

Manage a Transaction

View a transaction's attributes.
To view information about a transaction, such as its JNDI name, EIS product name and version, or its status, use the :read-resource CLI command.
View the participants of a transaction.
Each transaction log contains a child element called participants. Use the read-resource CLI command on this element to see the participants of the transaction. Participants are identified by their JNDI names.
The result may look similar to this:
   "outcome" => "success",
   "result" => {
       "eis-product-name" => "HornetQ",
       "eis-product-version" => "2.0",
       "jndi-name" => "java:/JmsXA",
       "status" => "HEURISTIC",
       "type" => "/StateManager/AbstractRecord/XAResourceRecord"
The outcome status shown here is in a HEURISTIC state and is eligible for recovery. See Recover a transaction. for more details.
In special cases it is possible to create orphan records in the object store, that is XAResourceRecords, which do not have any corresponding transaction record in the log. For example, XA resource prepared but crashed before the TM recorded and is inaccessible for the domain management API. To access such records you need to set management option expose-all-logs to true. This option is not saved in management model and is restored to false when the server is restarted.
/profile=default/subsystem=transactions/log-store=log-store:write-attribute(name=expose-all-logs, value=true)
Delete a transaction.
Each transaction log supports a :delete operation, to delete the transaction log representing the transaction.
Recover a transaction.
Each transaction participant supports recovery via the :recover CLI command.

Recovery of heuristic transactions and participants

  • If the transaction's status is HEURISTIC, the recovery operation changes the state to PREPARE and triggers a recovery.
  • If one of the transaction's participants is heuristic, the recovery operation tries to replay the commit operation. If successful, the participant is removed from the transaction log. You can verify this by re-running the :probe operation on the log-store and checking that the participant is no longer listed. If this is the last participant, the transaction is also deleted.
Refresh the status of a transaction which needs recovery.
If a transaction needs recovery, you can use the :refresh CLI command to be sure it still requires recovery, before attempting the recovery.
View Transaction Statistics

If Transaction Manager statistics are enabled, you can view statistics about the Transaction Manager and transaction subsystem. See Section 19.1.2, “Configure the Transaction Manager” for information about how to enable Transaction Manager statistics.

You can view statistics either via the management console or the Management CLI. In the management console, transaction statistics are available via RuntimeStatusSubsystemsTransactions. Transaction statistics are available for each server in a managed domain. To view the status of a different server, select Change Server in the left-hand menu and select the server from the list.
The following table shows each available statistic, its description, and the Management CLI command to view the statistic.

Table 19.4. Transaction Subsystem Statistics

Statistic Description CLI Command
The total number of transactions processed by the Transaction Manager on this server.
The number of committed transactions processed by the Transaction Manager on this server.
The number of aborted transactions processed by the Transaction Manager on this server.
Timed Out
The number of timed out transactions processed by the Transaction Manager on this server.
Not available in the Management Console. Number of transactions in a heuristic state.
In-Flight Transactions
Not available in the Management Console. Number of transactions which have begun but not yet terminated.
Failure Origin - Applications
The number of failed transactions whose failure origin was an application.
Failure Origin - Resources
The number of failed transactions whose failure origin was a resource.
Participant ID
The ID of the participant.
List of all transactions
The complete list of transactions.