Infinispan Distribution 5.2.6.Final-redhat-2

org.infinispan.configuration.cache
Class TransactionConfigurationBuilder

java.lang.Object
  extended by org.infinispan.configuration.cache.TransactionConfigurationBuilder
All Implemented Interfaces:
Builder<TransactionConfiguration>, ConfigurationChildBuilder

public class TransactionConfigurationBuilder
extends Object
implements Builder<TransactionConfiguration>

Defines transactional (JTA) characteristics of the cache.

Author:
pmuir

Method Summary
 TransactionConfigurationBuilder autoCommit(boolean b)
          If the cache is transactional (i.e.
 Configuration build()
           
 TransactionConfigurationBuilder cacheStopTimeout(long l)
          If there are any ongoing transactions when a cache is stopped, Infinispan waits for ongoing remote and local transactions to finish.
 TransactionConfigurationBuilder cacheStopTimeout(long l, TimeUnit unit)
          If there are any ongoing transactions when a cache is stopped, Infinispan waits for ongoing remote and local transactions to finish.
 ClusteringConfigurationBuilder clustering()
           
 TransactionConfigurationBuilder completedTxTimeout(long timeout)
          The duration (millis) in which to keep information about the completion of a transaction.
 TransactionConfiguration create()
          Create the configuration bean
 CustomInterceptorsConfigurationBuilder customInterceptors()
           
 DataContainerConfigurationBuilder dataContainer()
           
 DeadlockDetectionConfigurationBuilder deadlockDetection()
           
 TransactionConfigurationBuilder eagerLockingSingleNode(boolean b)
          Deprecated. starting with Infinispan 5.1 single node locking is used by default
 EvictionConfigurationBuilder eviction()
           
 ExpirationConfigurationBuilder expiration()
           
protected  ConfigurationBuilder getBuilder()
           
 IndexingConfigurationBuilder indexing()
           
 InvocationBatchingConfigurationBuilder invocationBatching()
           
 JMXStatisticsConfigurationBuilder jmxStatistics()
           
 LoadersConfigurationBuilder loaders()
           
 LockingConfigurationBuilder locking()
           
 TransactionConfigurationBuilder lockingMode(LockingMode lockingMode)
          Configures whether the cache uses optimistic or pessimistic locking.
 TransactionConfigurationBuilder read(TransactionConfiguration template)
          Reads the configuration from an already created configuration bean into this builder.
 TransactionConfigurationBuilder reaperWakeUpInterval(long interval)
          The time interval (millis) at which the thread that cleans up transaction completion information kicks in.
 RecoveryConfigurationBuilder recovery()
          This method allows configuration of the transaction recovery cache.
 SitesConfigurationBuilder sites()
           
 StoreAsBinaryConfigurationBuilder storeAsBinary()
           
 TransactionConfigurationBuilder 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.
 TransactionConfigurationBuilder 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()
           
 TransactionConfigurationBuilder transaction()
           
 TransactionConfigurationBuilder transactionManagerLookup(TransactionManagerLookup tml)
          Configure Transaction manager lookup directly using an instance of TransactionManagerLookup.
 TransactionConfigurationBuilder transactionMode(TransactionMode transactionMode)
           
 TransactionConfigurationBuilder transactionSynchronizationRegistryLookup(TransactionSynchronizationRegistryLookup lookup)
          Configure Transaction Synchronization Registry lookup directly using an instance of TransactionManagerLookup.
 UnsafeConfigurationBuilder unsafe()
           
 TransactionConfigurationBuilder use1PcForAutoCommitTransactions(boolean b)
          Before Infinispan 5.1 you could access the cache both transactionally and non-transactionally.
 TransactionConfigurationBuilder useEagerLocking(boolean b)
          Deprecated. 
 TransactionConfigurationBuilder useSynchronization(boolean b)
          Configures whether the cache registers a synchronization with the transaction manager, or registers itself as an XA resource.
 void validate()
          Validate the data in this builder before building the configuration bean
 VersioningConfigurationBuilder versioning()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

autoCommit

public TransactionConfigurationBuilder autoCommit(boolean b)
If the cache is transactional (i.e. transactionMode(org.infinispan.transaction.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 TransactionConfigurationBuilder 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.

This configuration property may be adjusted at runtime


cacheStopTimeout

public TransactionConfigurationBuilder cacheStopTimeout(long l,
                                                        TimeUnit unit)
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.

This configuration property may be adjusted at runtime


eagerLockingSingleNode

@Deprecated
public TransactionConfigurationBuilder eagerLockingSingleNode(boolean b)
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 TransactionConfigurationBuilder lockingMode(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:
Configuration.isTransactionalCache()

syncCommitPhase

public TransactionConfigurationBuilder 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.

This configuration property may be adjusted at runtime


syncRollbackPhase

public TransactionConfigurationBuilder 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.

This configuration property may be adjusted at runtime.


transactionManagerLookup

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


transactionSynchronizationRegistryLookup

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


transactionMode

public TransactionConfigurationBuilder transactionMode(TransactionMode transactionMode)

useEagerLocking

@Deprecated
public TransactionConfigurationBuilder useEagerLocking(boolean b)
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.


useSynchronization

public TransactionConfigurationBuilder useSynchronization(boolean b)
Configures whether the cache registers a synchronization with the transaction manager, or registers itself as an XA resource. It is often unnecessary to register as a full XA resource unless you intend to make use of recovery as well, and registering a synchronization is significantly more efficient.

Parameters:
b - if true, Synchronizations are used rather than XAResources when communicating with a TransactionManager.

recovery

public RecoveryConfigurationBuilder 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 FluentConfiguration.RecoveryConfig.disable()


use1PcForAutoCommitTransactions

public TransactionConfigurationBuilder use1PcForAutoCommitTransactions(boolean b)
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).


reaperWakeUpInterval

public TransactionConfigurationBuilder reaperWakeUpInterval(long interval)
The time interval (millis) at which the thread that cleans up transaction completion information kicks in. Defaults to 1000.


completedTxTimeout

public TransactionConfigurationBuilder completedTxTimeout(long timeout)
The duration (millis) in which to keep information about the completion of a transaction. Defaults to 3000.


validate

public void validate()
Description copied from interface: Builder
Validate the data in this builder before building the configuration bean

Specified by:
validate in interface Builder<TransactionConfiguration>

create

public TransactionConfiguration create()
Description copied from interface: Builder
Create the configuration bean

Specified by:
create in interface Builder<TransactionConfiguration>
Returns:

read

public TransactionConfigurationBuilder read(TransactionConfiguration template)
Description copied from interface: Builder
Reads the configuration from an already created configuration bean into this builder. Returns an appropriate builder to allow fluent configuration

Specified by:
read in interface Builder<TransactionConfiguration>
Parameters:
template - the configuration from which to "clone" this config if needed.

toString

public String toString()
Overrides:
toString in class Object

clustering

public ClusteringConfigurationBuilder clustering()
Specified by:
clustering in interface ConfigurationChildBuilder

customInterceptors

public CustomInterceptorsConfigurationBuilder customInterceptors()
Specified by:
customInterceptors in interface ConfigurationChildBuilder

dataContainer

public DataContainerConfigurationBuilder dataContainer()
Specified by:
dataContainer in interface ConfigurationChildBuilder

deadlockDetection

public DeadlockDetectionConfigurationBuilder deadlockDetection()
Specified by:
deadlockDetection in interface ConfigurationChildBuilder

eviction

public EvictionConfigurationBuilder eviction()
Specified by:
eviction in interface ConfigurationChildBuilder

expiration

public ExpirationConfigurationBuilder expiration()
Specified by:
expiration in interface ConfigurationChildBuilder

indexing

public IndexingConfigurationBuilder indexing()
Specified by:
indexing in interface ConfigurationChildBuilder

invocationBatching

public InvocationBatchingConfigurationBuilder invocationBatching()
Specified by:
invocationBatching in interface ConfigurationChildBuilder

jmxStatistics

public JMXStatisticsConfigurationBuilder jmxStatistics()
Specified by:
jmxStatistics in interface ConfigurationChildBuilder

loaders

public LoadersConfigurationBuilder loaders()
Specified by:
loaders in interface ConfigurationChildBuilder

locking

public LockingConfigurationBuilder locking()
Specified by:
locking in interface ConfigurationChildBuilder

storeAsBinary

public StoreAsBinaryConfigurationBuilder storeAsBinary()
Specified by:
storeAsBinary in interface ConfigurationChildBuilder

transaction

public TransactionConfigurationBuilder transaction()
Specified by:
transaction in interface ConfigurationChildBuilder

versioning

public VersioningConfigurationBuilder versioning()
Specified by:
versioning in interface ConfigurationChildBuilder

unsafe

public UnsafeConfigurationBuilder unsafe()
Specified by:
unsafe in interface ConfigurationChildBuilder

sites

public SitesConfigurationBuilder sites()
Specified by:
sites in interface ConfigurationChildBuilder

getBuilder

protected ConfigurationBuilder getBuilder()

build

public Configuration build()
Specified by:
build in interface ConfigurationChildBuilder

Infinispan Distribution 5.2.6.Final-redhat-2

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