18.6.3. Enable Transaction Recovery

Transaction recovery is disabled by default in JBoss Data Grid. When disabled, the Transaction Manager cannot determine which transactions require manual intervention.
Using XML

Enable transaction recovery using XML configuration as follows:

<transaction useEagerLocking="true" eagerLockSingleNode="true">
    <recovery enabled="true" recoveryInfoCacheName="noRecovery"/>
</transaction>

The recoveryInfoCacheName attribute is optional.
Programmatic Configuration

Alternatively, enable transaction recovery through the fluent configuration API as follows:

Procedure 18.2. Configure Transaction Recovery Programmatically

  1. To enable JBoss Data Grid's Transaction Recovery, call .recovery:
    configuration.fluent().transaction().recovery();
    
  2. To check Transactions Recovery's status, use the following programmatic configuration:
    boolean isRecoveryEnabled = configuration.isTransactionRecoveryEnabled();
    
  3. To disable JBoss Data Grid's Transaction recovery, use the following programmatic configuration:
    configuration.fluent().transaction().recovery().disable();
    
Transaction recovery can be enabled or disabled on a per cache basis. For example, it is possible for a transaction to span one cache with transaction recovery enabled and then another cache with transaction recovery disabled.