Chapter 21. Transaction Subsystem
21.1. Transaction Subsystem Configuration
21.1.1. Transactions Configuration Overview
The following procedures show you how to configure the transactions subsystem of JBoss EAP 6.
21.1.2. Configure the Transaction Manager
default, you may need to modify the steps and commands in the following ways.
Notes about the Example Commands
- For the Management Console, the
defaultprofile is the one which is selected when you first log into the console. If you need to modify the Transaction Manager's configuration in a different profile, select your profile instead of
default, in each instruction.Similarly, substitute your profile for the
defaultprofile in the example CLI commands.
- If you use a Standalone Server, only one profile exists. Ignore any instructions to choose a specific profile. In CLI commands, remove the
/profile=defaultportion of the sample commands.
transactionssubsystem must be enabled. It is enabled by default, and required for many other subsystems to function properly, so it is very unlikely that it would be disabled.
To configure the TM using the web-based Management Console, select the Configuration tab from the top of the screen. If you use a managed domain, choose the correct profile from the Profile selection box at the top left. Expand the Container menu and select Transactions.
In the Management CLI, you can configure the TM using a series of commands. The commands all begin with
/profile=default/subsystem=transactions/ for a managed domain with profile
/subsystem=transactions for a Standalone Server.
Table 21.1. TM Configuration Options
Whether to enable transaction statistics. These statistics can be viewed in the Management Console in the Subsystem Metrics section of the Runtime tab.
The default transaction timeout. This defaults to
Object Store Path
A relative or absolute filesystem path where the TM object store stores data. By default relative to the
Object Store Path Relative To
References a global path configuration in the domain model. The default value is the data directory for JBoss EAP 6, which is the value of the property
Specifies the name of the socket binding used by the Transaction Manager for recovery and generating transaction identifiers, when the socket-based mechanism is used. Refer to
Whether or not the Transaction Recovery process should listen on a network socket. Defaults to
Table 21.2. Advanced TM Configuration Options
Whether to use Java Transaction Service (JTS) transactions. Defaults to
The node identifier for the Transaction Manager. This option is required in the following situations:
The Transaction Manager creates a unique identifier for each transaction log. Two different mechanisms are provided for generating unique identifiers: a socket-based mechanism and a mechanism based on the process identifier of the process.
In the case of the socket-based identifier, a socket is opened and its port number is used for the identifier. If the port is already in use, the next port is probed, until a free one is found. The
Use HornetQ's journaled storage mechanisms instead of file-based storage, for the transaction logs. This is disabled by default, but can improve I/O performance. It is not recommended for JTS transactions on separate Transaction Managers. When changing this option, the server has to be restarted using the
21.1.3. Configure Your Datasource to Use JTA Transaction API
This task shows you how to enable Java Transaction API (JTA) on your datasource.
You must meet the following conditions before continuing with this task:
- Your database or other resource must support Java Transaction API. If in doubt, consult the documentation for your database or other resource.
- Create a datasource. Refer to Section 6.3.1, “Create a Non-XA Datasource with the Management Interfaces”.
- Stop JBoss EAP 6.
- Have access to edit the configuration files directly, in a text editor.
Procedure 21.1. Configure the Datasource to use Java Transaction API
Open the configuration file in a text editor.Depending on whether you run JBoss EAP 6 in a managed domain or standalone server, your configuration file will be in a different location.
Managed domainThe default configuration file for a managed domain is in
EAP_HOME/domain/configuration/domain.xmlfor Red Hat Enterprise Linux, and
EAP_HOME\domain\configuration\domain.xmlfor Microsoft Windows Server.
Standalone serverThe default configuration file for a standalone server is in
EAP_HOME/standalone/configuration/standalone.xmlfor Red Hat Enterprise Linux, and
EAP_HOME\standalone\configuration\standalone.xmlfor Microsoft Windows Server.
<datasource>tag that corresponds to your datasource.The datasource will have the
jndi-nameattribute set to the one you specified when you created it. For example, the ExampleDS datasource looks like this:
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="H2DS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
true.Add the following to the contents of your
<datasource>tag, as they appear in the previous step:
Save the configuration file.Save the configuration file and exit the text editor.
Start JBoss EAP 6.Relaunch the JBoss EAP 6 server.
JBoss EAP 6 starts, and your datasource is configured to use Java Transaction API.
21.1.4. Configure an XA Datasource
In order to add an XA Datasource, you need to log into the Management Console. See Section 3.4.2, “Log in to the Management Console” for more information.
Add a new datasource.Add a new datasource to JBoss EAP 6. Follow the instructions in Section 6.3.1, “Create a Non-XA Datasource with the Management Interfaces”, but click the XA Datasource tab at the top.
Configure additional properties as appropriate.All datasource parameters are listed in Section 6.7.1, “Datasource Parameters”.
Your XA Datasource is configured and ready to use.
21.1.5. About Transaction Log Messages
DEBUGlog level for the transaction logger. For detailed debugging, use the
TRACElog level. Refer to Section 21.1.6, “Configure Logging for the Transaction Subsystem” for information on configuring the transaction logger.
TRACElog level. Following are some of the most commonly-seen messages. This list is not comprehensive, so you may see other messages than these.
Table 21.3. Transaction State Change
|Transaction Begin|| |
When a transaction begins, the following code is executed:
tsLogger.logger.trace("BasicAction::Begin() for action-id "+ get_uid());
|Transaction Commit|| |
When a transaction commits, the following code is executed:
tsLogger.logger.trace("BasicAction::End() for action-id "+ get_uid());
|Transaction Rollback|| |
When a transaction rolls back, the following code is executed:
tsLogger.logger.trace("BasicAction::Abort() for action-id "+ get_uid());
|Transaction Timeout|| |
When a transaction times out, the following code is executed:
tsLogger.logger.trace("Reaper Worker " + Thread.currentThread() + " attempting to cancel " + e._control.get_uid());
You will then see the same thread rolling back the transaction as shown above.
21.1.6. Configure Logging for the Transaction Subsystem
Use this procedure to control the amount of information logged about transactions, independent of other logging settings in JBoss EAP 6. The main procedure shows how to do this in the web-based Management Console. The Management CLI command is given afterward.
Procedure 21.2. Configure the Transaction Logger Using the Management Console
Navigate to the Logging configuration area.In the Management Console, click the Configuration tab. If you use a managed domain, choose the server profile you wish to configure, from the Profile selection box at the top left.Expand the Core menu, and select Logging.
com.arjunaattributes.Select the Log Categories tab. Select
com.arjunaand lick Edit in the Details section. This is where you can add class-specific logging information. The
com.arjunaclass is already present. You can change the log level and whether to use parent handlers.
- Log Level
- The log level is
WARNby default. Because transactions can produce a large quantity of logging output, the meaning of the standard logging levels is slightly different for the transaction logger. In general, messages tagged with levels at a lower severity than the chosen level are discarded.
Transaction Logging Levels, from Most to Least Verbose
- Use Parent Handlers
- Whether the logger should send its output to its parent logger. The default behavior is
- Changes take effect immediately.