Class TransactionConfigurationBuilder
- java.lang.Object
-
- org.infinispan.configuration.cache.TransactionConfigurationBuilder
-
- All Implemented Interfaces:
BaseConfigurationInfo
,Builder<TransactionConfiguration>
,ConfigurationBuilderInfo
,ConfigurationChildBuilder
public class TransactionConfigurationBuilder extends Object implements Builder<TransactionConfiguration>, ConfigurationBuilderInfo
Defines transactional (JTA) characteristics of the cache.- Author:
- pmuir, Pedro Ruivo
-
-
Field Summary
Fields Modifier and Type Field Description protected ConfigurationBuilder
builder
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description org.infinispan.commons.configuration.attributes.AttributeSet
attributes()
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 beanCustomInterceptorsConfigurationBuilder
customInterceptors()
Deprecated.Since 10.0, custom interceptors support will be removed and only modules will be able to define interceptorsEncodingConfigurationBuilder
encoding()
ExpirationConfigurationBuilder
expiration()
protected ConfigurationBuilder
getBuilder()
Collection<ConfigurationBuilderInfo>
getChildrenInfo()
org.infinispan.commons.configuration.elements.ElementDefinition
getElementDefinition()
IndexingConfigurationBuilder
indexing()
InvocationBatchingConfigurationBuilder
invocationBatching()
LockingConfigurationBuilder
locking()
TransactionConfigurationBuilder
lockingMode(LockingMode lockingMode)
Configures whether the cache uses optimistic or pessimistic locking.MemoryConfigurationBuilder
memory()
TransactionConfigurationBuilder
notifications(boolean enabled)
PersistenceConfigurationBuilder
persistence()
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.SecurityConfigurationBuilder
security()
boolean
simpleCache()
ConfigurationChildBuilder
simpleCache(boolean simpleCache)
SitesConfigurationBuilder
sites()
StatisticsConfigurationBuilder
statistics()
ConfigurationChildBuilder
template(boolean template)
String
toString()
TransactionConfigurationBuilder
transaction()
org.infinispan.commons.tx.lookup.TransactionManagerLookup
transactionManagerLookup()
TransactionConfigurationBuilder
transactionManagerLookup(org.infinispan.commons.tx.lookup.TransactionManagerLookup tml)
Configure Transaction manager lookup directly using an instance of TransactionManagerLookup.TransactionMode
transactionMode()
TransactionConfigurationBuilder
transactionMode(TransactionMode transactionMode)
TransactionConfigurationBuilder
transactionSynchronizationRegistryLookup(org.infinispan.transaction.lookup.TransactionSynchronizationRegistryLookup lookup)
Configure Transaction Synchronization Registry lookup directly using an instance of TransactionManagerLookup.UnsafeConfigurationBuilder
unsafe()
boolean
use1PcForAutoCommitTransactions()
TransactionConfigurationBuilder
use1PcForAutoCommitTransactions(boolean b)
Before Infinispan 5.1 you could access the cache both transactionally and non-transactionally.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 beanvoid
validate(GlobalConfiguration globalConfig)
-
Methods inherited from interface org.infinispan.commons.configuration.ConfigurationBuilderInfo
getBuilderInfo, getNewBuilderInfo
-
Methods inherited from interface org.infinispan.configuration.cache.ConfigurationChildBuilder
jmxStatistics
-
-
-
-
Field Detail
-
builder
protected final ConfigurationBuilder builder
-
-
Method Detail
-
attributes
public org.infinispan.commons.configuration.attributes.AttributeSet attributes()
- Specified by:
attributes
in interfaceBaseConfigurationInfo
- Returns:
- the
AttributeSet
declared by the configuration.
-
getElementDefinition
public org.infinispan.commons.configuration.elements.ElementDefinition getElementDefinition()
- Specified by:
getElementDefinition
in interfaceBaseConfigurationInfo
- Returns:
- the
ElementDefinition
of the configuration.
-
getChildrenInfo
public Collection<ConfigurationBuilderInfo> getChildrenInfo()
- Specified by:
getChildrenInfo
in interfaceConfigurationBuilderInfo
- Returns:
- a collection of
ConfigurationBuilderInfo
for the sub-elements of the builder.
-
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.
-
transactionManagerLookup
public TransactionConfigurationBuilder transactionManagerLookup(org.infinispan.commons.tx.lookup.TransactionManagerLookup tml)
Configure Transaction manager lookup directly using an instance of TransactionManagerLookup. Calling this method marks the cache as transactional.
-
transactionManagerLookup
public org.infinispan.commons.tx.lookup.TransactionManagerLookup transactionManagerLookup()
-
transactionSynchronizationRegistryLookup
public TransactionConfigurationBuilder transactionSynchronizationRegistryLookup(org.infinispan.transaction.lookup.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,Synchronization
s are used rather thanXAResource
s 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.
-
notifications
public TransactionConfigurationBuilder notifications(boolean enabled)
- Returns:
- are transactional notifications (
TransactionRegistered
andTransactionCompleted
) triggered?
-
validate
public void validate()
Description copied from interface:Builder
Validate the data in this builder before building the configuration bean- Specified by:
validate
in interfaceBuilder<TransactionConfiguration>
-
validate
public void validate(GlobalConfiguration globalConfig)
- Specified by:
validate
in interfaceConfigurationChildBuilder
-
create
public TransactionConfiguration create()
Description copied from interface:Builder
Create the configuration bean- Specified by:
create
in interfaceBuilder<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 interfaceBuilder<TransactionConfiguration>
- Parameters:
template
- the configuration from which to "clone" this config if needed.
-
toString
public String toString()
-
template
public ConfigurationChildBuilder template(boolean template)
- Specified by:
template
in interfaceConfigurationChildBuilder
-
simpleCache
public ConfigurationChildBuilder simpleCache(boolean simpleCache)
- Specified by:
simpleCache
in interfaceConfigurationChildBuilder
-
simpleCache
public boolean simpleCache()
- Specified by:
simpleCache
in interfaceConfigurationChildBuilder
-
clustering
public ClusteringConfigurationBuilder clustering()
- Specified by:
clustering
in interfaceConfigurationChildBuilder
-
customInterceptors
@Deprecated public CustomInterceptorsConfigurationBuilder customInterceptors()
Deprecated.Since 10.0, custom interceptors support will be removed and only modules will be able to define interceptors- Specified by:
customInterceptors
in interfaceConfigurationChildBuilder
-
encoding
public EncodingConfigurationBuilder encoding()
- Specified by:
encoding
in interfaceConfigurationChildBuilder
-
expiration
public ExpirationConfigurationBuilder expiration()
- Specified by:
expiration
in interfaceConfigurationChildBuilder
-
indexing
public IndexingConfigurationBuilder indexing()
- Specified by:
indexing
in interfaceConfigurationChildBuilder
-
invocationBatching
public InvocationBatchingConfigurationBuilder invocationBatching()
- Specified by:
invocationBatching
in interfaceConfigurationChildBuilder
-
statistics
public StatisticsConfigurationBuilder statistics()
- Specified by:
statistics
in interfaceConfigurationChildBuilder
-
persistence
public PersistenceConfigurationBuilder persistence()
- Specified by:
persistence
in interfaceConfigurationChildBuilder
-
locking
public LockingConfigurationBuilder locking()
- Specified by:
locking
in interfaceConfigurationChildBuilder
-
security
public SecurityConfigurationBuilder security()
- Specified by:
security
in interfaceConfigurationChildBuilder
-
transaction
public TransactionConfigurationBuilder transaction()
- Specified by:
transaction
in interfaceConfigurationChildBuilder
-
unsafe
public UnsafeConfigurationBuilder unsafe()
- Specified by:
unsafe
in interfaceConfigurationChildBuilder
-
sites
public SitesConfigurationBuilder sites()
- Specified by:
sites
in interfaceConfigurationChildBuilder
-
memory
public MemoryConfigurationBuilder memory()
- Specified by:
memory
in interfaceConfigurationChildBuilder
-
getBuilder
protected ConfigurationBuilder getBuilder()
-
build
public Configuration build()
- Specified by:
build
in interfaceConfigurationChildBuilder
-
-