org.infinispan.configuration.cache
Class TransactionConfiguration

java.lang.Object
  extended by org.infinispan.configuration.cache.TransactionConfiguration

public class TransactionConfiguration
extends Object

Defines transactional (JTA) characteristics of the cache.

Author:
pmuir

Method Summary
 boolean autoCommit()
          If the cache is transactional (i.e.
 long cacheStopTimeout()
          If there are any ongoing transactions when a cache is stopped, Infinispan waits for ongoing remote and local transactions to finish.
 TransactionConfiguration cacheStopTimeout(long l)
          If there are any ongoing transactions when a cache is stopped, Infinispan waits for ongoing remote and local transactions to finish.
 boolean eagerLockingSingleNode()
          Deprecated. starting with Infinispan 5.1 single node locking is used by default
 boolean equals(Object o)
           
 int hashCode()
           
 LockingMode lockingMode()
          Configures whether the cache uses optimistic or pessimistic locking.
 RecoveryConfiguration recovery()
          This method allows configuration of the transaction recovery cache.
 boolean syncCommitPhase()
           
 TransactionConfiguration syncCommitPhase(boolean b)
          If true, the cluster-wide commit phase in two-phase commit (2PC) transactions will be synchronous, so Infinispan will wait for responses from all nodes to which the commit was sent.
 boolean syncRollbackPhase()
          If true, the cluster-wide rollback phase in two-phase commit (2PC) transactions will be synchronous, so Infinispan will wait for responses from all nodes to which the rollback was sent.
 TransactionConfiguration syncRollbackPhase(boolean b)
          If true, the cluster-wide rollback phase in two-phase commit (2PC) transactions will be synchronous, so Infinispan will wait for responses from all nodes to which the rollback was sent.
 String toString()
           
 TransactionManagerLookup transactionManagerLookup()
          Configure Transaction manager lookup directly using an instance of TransactionManagerLookup.
 TransactionMode transactionMode()
           
 TransactionSynchronizationRegistryLookup transactionSynchronizationRegistryLookup()
          Configure Transaction Synchronization Registry lookup directly using an instance of TransactionManagerLookup.
 boolean use1PcForAutoCommitTransactions()
          Before Infinispan 5.1 you could access the cache both transactionally and non-transactionally.
 boolean useEagerLocking()
          Deprecated. 
 TransactionConfiguration useEagerLocking(boolean b)
          Deprecated. 
 boolean useSynchronization()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

autoCommit

public boolean autoCommit()
If the cache is transactional (i.e. transactionMode() == TransactionMode.TRANSACTIONAL) and transactionAutoCommit is enabled then for single operation transactions the user doesn't need to manually start a transaction, but a transactions is injected by the system. Defaults to true.


cacheStopTimeout

public TransactionConfiguration cacheStopTimeout(long l)
If there are any ongoing transactions when a cache is stopped, Infinispan waits for ongoing remote and local transactions to finish. The amount of time to wait for is defined by the cache stop timeout. It is recommended that this value does not exceed the transaction timeout because even if a new transaction was started just before the cache was stopped, this could only last as long as the transaction timeout allows it.


cacheStopTimeout

public long cacheStopTimeout()
If there are any ongoing transactions when a cache is stopped, Infinispan waits for ongoing remote and local transactions to finish. The amount of time to wait for is defined by the cache stop timeout. It is recommended that this value does not exceed the transaction timeout because even if a new transaction was started just before the cache was stopped, this could only last as long as the transaction timeout allows it.


eagerLockingSingleNode

@Deprecated
public boolean eagerLockingSingleNode()
Deprecated. starting with Infinispan 5.1 single node locking is used by default

Only has effect for DIST mode and when useEagerLocking is set to true. When this is enabled, then only one node is locked in the cluster, disregarding numOwners config. On the opposite, if this is false, then on all cache.lock() calls numOwners RPCs are being performed. The node that gets locked is the main data owner, i.e. the node where data would reside if numOwners==1. If the node where the lock resides crashes, then the transaction is marked for rollback - data is in a consistent state, no fault tolerance.


lockingMode

public LockingMode lockingMode()
Configures whether the cache uses optimistic or pessimistic locking. If the cache is not transactional then the locking mode is ignored.

See Also:
transactionMode()

syncCommitPhase

public boolean syncCommitPhase()

syncCommitPhase

public TransactionConfiguration syncCommitPhase(boolean b)
If true, the cluster-wide commit phase in two-phase commit (2PC) transactions will be synchronous, so Infinispan will wait for responses from all nodes to which the commit was sent. Otherwise, the commit phase will be asynchronous. Keeping it as false improves performance of 2PC transactions, since any remote failures are trapped during the prepare phase anyway and appropriate rollbacks are issued.


syncRollbackPhase

public boolean syncRollbackPhase()
If true, the cluster-wide rollback phase in two-phase commit (2PC) transactions will be synchronous, so Infinispan will wait for responses from all nodes to which the rollback was sent. Otherwise, the rollback phase will be asynchronous. Keeping it as false improves performance of 2PC transactions.

Returns:

syncRollbackPhase

public TransactionConfiguration syncRollbackPhase(boolean b)
If true, the cluster-wide rollback phase in two-phase commit (2PC) transactions will be synchronous, so Infinispan will wait for responses from all nodes to which the rollback was sent. Otherwise, the rollback phase will be asynchronous. Keeping it as false improves performance of 2PC transactions.

Parameters:
b -
Returns:

transactionManagerLookup

public TransactionManagerLookup transactionManagerLookup()
Configure Transaction manager lookup directly using an instance of TransactionManagerLookup. Calling this method marks the cache as transactional.


transactionSynchronizationRegistryLookup

public TransactionSynchronizationRegistryLookup transactionSynchronizationRegistryLookup()
Configure Transaction Synchronization Registry lookup directly using an instance of TransactionManagerLookup. Calling this method marks the cache as transactional.


transactionMode

public TransactionMode transactionMode()

useEagerLocking

@Deprecated
public boolean useEagerLocking()
Deprecated. 

Only has effect for DIST mode and when useEagerLocking is set to true. When this is enabled, then only one node is locked in the cluster, disregarding numOwners config. On the opposite, if this is false, then on all cache.lock() calls numOwners RPCs are being performed. The node that gets locked is the main data owner, i.e. the node where data would reside if numOwners==1. If the node where the lock resides crashes, then the transaction is marked for rollback - data is in a consistent state, no fault tolerance.

Note: Starting with infinispan 5.1 eager locking is replaced with pessimistic locking and can be enforced by setting transaction's locking mode to PESSIMISTIC.


useEagerLocking

@Deprecated
public TransactionConfiguration useEagerLocking(boolean b)
Deprecated. 


useSynchronization

public boolean useSynchronization()

recovery

public RecoveryConfiguration recovery()
This method allows configuration of the transaction recovery cache. When this method is called, it automatically enables recovery. So, if you want it to be disabled, make sure you call RecoveryConfigurationBuilder.enabled(boolean) with false as parameter


use1PcForAutoCommitTransactions

public boolean use1PcForAutoCommitTransactions()
Before Infinispan 5.1 you could access the cache both transactionally and non-transactionally. Naturally the non-transactional access is faster and offers less consistency guarantees. From Infinispan 5.1 onwards, mixed access is no longer supported, so if you wanna speed up transactional caches and you're ready to trade some consistency guarantees, you can enable use1PcForAutoCommitTransactions.

What this configuration option does is force an induced transaction, that has been started by Infinispan as a result of enabling autoCommit, to commit in a single phase. So only 1 RPC instead of 2RPCs as in the case of a full 2 Phase Commit (2PC).


toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

-->

Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.