Class TransactionConfigurationBuilder
- java.lang.Object
-
- 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, Pedro Ruivo
-
-
Field Summary
Fields Modifier and Type Field Description protected ConfigurationBuilderbuilder
-
Method Summary
-
-
-
Field Detail
-
builder
protected final ConfigurationBuilder builder
-
-
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
-
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.
-
syncCommitPhase
@Deprecated public TransactionConfigurationBuilder syncCommitPhase(boolean b)
Deprecated.since 9.0. no longer supportedIf 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, but it can lead to inconsistencies when a backup owner only commits the transaction after the primary owner released the lock.
-
syncRollbackPhase
@Deprecated public TransactionConfigurationBuilder syncRollbackPhase(boolean b)
Deprecated.since 9.0. no longer supportedIf 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 can lead to inconsistencies when a transaction is rolled back because of a commit timeout, as a backup owner could commit the transaction after the primary released the lock.
-
transactionManagerLookup
public TransactionConfigurationBuilder transactionManagerLookup(TransactionManagerLookup tml)
Configure Transaction manager lookup directly using an instance of TransactionManagerLookup. Calling this method marks the cache as transactional.
-
transactionManagerLookup
public TransactionManagerLookup transactionManagerLookup()
-
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)
-
transactionMode
public TransactionMode transactionMode()
-
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 thanXAResources when communicating with aTransactionManager.
-
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 callRecoveryConfigurationBuilder.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).
-
use1PcForAutoCommitTransactions
public boolean use1PcForAutoCommitTransactions()
-
reaperWakeUpInterval
public TransactionConfigurationBuilder reaperWakeUpInterval(long interval)
The time interval (millis) at which the thread that cleans up transaction completion information kicks in. Defaults to 30000.
-
completedTxTimeout
public TransactionConfigurationBuilder completedTxTimeout(long timeout)
The duration (millis) in which to keep information about the completion of a transaction. Defaults to 60000.
-
transactionProtocol
public TransactionConfigurationBuilder transactionProtocol(TransactionProtocol transactionProtocol)
-
transactionProtocol
public TransactionProtocol transactionProtocol()
- Returns:
- the current configured
TransactionProtocol.
-
notifications
public TransactionConfigurationBuilder notifications(boolean enabled)
- Returns:
- are transactional notifications (
TransactionRegisteredandTransactionCompleted) triggered?
-
validate
public void validate()
Description copied from interface:BuilderValidate the data in this builder before building the configuration bean- Specified by:
validatein interfaceBuilder<TransactionConfiguration>
-
validate
public void validate(GlobalConfiguration globalConfig)
- Specified by:
validatein interfaceConfigurationChildBuilder
-
create
public TransactionConfiguration create()
Description copied from interface:BuilderCreate the configuration bean- Specified by:
createin interfaceBuilder<TransactionConfiguration>- Returns:
-
read
public TransactionConfigurationBuilder read(TransactionConfiguration template)
Description copied from interface:BuilderReads the configuration from an already created configuration bean into this builder. Returns an appropriate builder to allow fluent configuration- Specified by:
readin interfaceBuilder<TransactionConfiguration>- Parameters:
template- the configuration from which to "clone" this config if needed.
-
template
public ConfigurationChildBuilder template(boolean template)
- Specified by:
templatein interfaceConfigurationChildBuilder
-
simpleCache
public ConfigurationChildBuilder simpleCache(boolean simpleCache)
- Specified by:
simpleCachein interfaceConfigurationChildBuilder
-
simpleCache
public boolean simpleCache()
- Specified by:
simpleCachein interfaceConfigurationChildBuilder
-
clustering
public ClusteringConfigurationBuilder clustering()
- Specified by:
clusteringin interfaceConfigurationChildBuilder
-
customInterceptors
public CustomInterceptorsConfigurationBuilder customInterceptors()
- Specified by:
customInterceptorsin interfaceConfigurationChildBuilder
-
dataContainer
public DataContainerConfigurationBuilder dataContainer()
- Specified by:
dataContainerin interfaceConfigurationChildBuilder
-
deadlockDetection
public DeadlockDetectionConfigurationBuilder deadlockDetection()
- Specified by:
deadlockDetectionin interfaceConfigurationChildBuilder
-
encoding
public EncodingConfigurationBuilder encoding()
- Specified by:
encodingin interfaceConfigurationChildBuilder
-
eviction
public EvictionConfigurationBuilder eviction()
- Specified by:
evictionin interfaceConfigurationChildBuilder
-
expiration
public ExpirationConfigurationBuilder expiration()
- Specified by:
expirationin interfaceConfigurationChildBuilder
-
indexing
public IndexingConfigurationBuilder indexing()
- Specified by:
indexingin interfaceConfigurationChildBuilder
-
invocationBatching
public InvocationBatchingConfigurationBuilder invocationBatching()
- Specified by:
invocationBatchingin interfaceConfigurationChildBuilder
-
jmxStatistics
public JMXStatisticsConfigurationBuilder jmxStatistics()
- Specified by:
jmxStatisticsin interfaceConfigurationChildBuilder
-
persistence
public PersistenceConfigurationBuilder persistence()
- Specified by:
persistencein interfaceConfigurationChildBuilder
-
locking
public LockingConfigurationBuilder locking()
- Specified by:
lockingin interfaceConfigurationChildBuilder
-
security
public SecurityConfigurationBuilder security()
- Specified by:
securityin interfaceConfigurationChildBuilder
-
storeAsBinary
@Deprecated public StoreAsBinaryConfigurationBuilder storeAsBinary()
Deprecated.- Specified by:
storeAsBinaryin interfaceConfigurationChildBuilder
-
transaction
public TransactionConfigurationBuilder transaction()
- Specified by:
transactionin interfaceConfigurationChildBuilder
-
versioning
public VersioningConfigurationBuilder versioning()
- Specified by:
versioningin interfaceConfigurationChildBuilder
-
unsafe
public UnsafeConfigurationBuilder unsafe()
- Specified by:
unsafein interfaceConfigurationChildBuilder
-
sites
public SitesConfigurationBuilder sites()
- Specified by:
sitesin interfaceConfigurationChildBuilder
-
compatibility
@Deprecated public CompatibilityModeConfigurationBuilder compatibility()
Deprecated.- Specified by:
compatibilityin interfaceConfigurationChildBuilder
-
memory
public MemoryConfigurationBuilder memory()
- Specified by:
memoryin interfaceConfigurationChildBuilder
-
getBuilder
protected ConfigurationBuilder getBuilder()
-
build
public Configuration build()
- Specified by:
buildin interfaceConfigurationChildBuilder
-
-