29.2. Configure Transactions

29.2.1. Configure Transactions (Library Mode)

In Red Hat JBoss Data Grid, transactions in Library mode can be configured with synchronization and transaction recovery. Transactions in their entirety (which includes synchronization and transaction recovery) are not available in Remote Client-Server mode.
In order to execute a cache operation, the cache requires a reference to the environment's Transaction Manager. Configure the cache with the class name that belongs to an implementation of the TransactionManagerLookup interface. When initialized, the cache creates an instance of the specified class and invokes its getTransactionManager() method to locate and return a reference to the Transaction Manager.
In Library mode, transactions are configured as follows:

Procedure 29.1. Configure Transactions in Library Mode (XML Configuration)

<local-cache name="default" <!-- Additional configuration information here -->>
	<transaction mode="BATCH"
	    stop-timeout="60000"
	    auto-commit="true"
	    protocol="DEFAULT"
	    recovery-cache="recoveryCache">
	<locking <!-- Additional configuration information here --> >
	<versioning versioningScheme="SIMPLE"/>
  <!-- Additional configuration information here -->
</local-cache>
  1. Enable transactions by defining a mode. By default the mode is NONE, therefore disabling transactions. Valid transaction modes are BATCH, NON_XA, NON_DURABLE_XA, FULL_XA.
  2. Define a stop-timeout, so that if there are any ongoing transactions when a cache is stopped the instance will wait for ongoing transactions to finish. Defaults to 30000 milliseconds.
  3. Enable auto-commit, so that single operation transactions do not need to be manually initiated. Defaults to true.
  4. Define the commit protocol in use. Valid commit protocols are DEFAULT and TOTAL_ORDER.
  5. Define the name of the recovery-cache, where recovery related information is kept. Defaults to __recoveryInfoCacheName__.
  6. Enable versioning of entries by defining the versioningScheme attribute as SIMPLE. Defaults to NONE, indicating that versioning is disabled.

29.2.2. Configure Transactions (Remote Client-Server Mode)

Red Hat JBoss Data Grid does not offer transactions in Remote Client-Server mode. The default and only supported configuration is non-transactional, which is set as follows:

Example 29.1. Transaction Configuration in Remote Client-Server Mode

<cache>
	<!-- Additional configuration elements here -->
 	<transaction mode="NONE" />
	<!-- Additional configuration elements here -->
</cache>