Class GlobalTxTable
- java.lang.Object
-
- org.infinispan.server.hotrod.tx.table.GlobalTxTable
-
- All Implemented Interfaces:
Runnable,org.infinispan.commons.api.Lifecycle
public class GlobalTxTable extends Object implements Runnable, org.infinispan.commons.api.Lifecycle
It is a transaction log that registers all the transaction decisions before changing the cache.The transaction state is stored in
TxState, and that is stored in a replicated cache. TheTxStatemust be updated before performing any action in the transaction (prepare, commit, etc.).In addition, since we don't have a client crash notification, it performs a reaper work, periodically, that cleanups idle transactions. The transaction is considered idle based on the timeout sent by the client. If no decision is made, it rollbacks the transaction. If the transaction is completed (committed or rolled-back), it is removed from the cache. If the transaction is decided (i.e. marked for commit or rollback), it completes the transaction.
Note that, recoverable transactions (transactions originated from FULL_XA support caches) aren't touched by the reaper. The recovery process is responsible to handle them.
- Since:
- 9.4
- Author:
- Pedro Ruivo
-
-
Constructor Summary
Constructors Constructor Description GlobalTxTable(org.infinispan.Cache<CacheXid,TxState> storage, org.infinispan.factories.GlobalComponentRegistry gcr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidforgetTransaction(org.infinispan.commons.tx.XidImpl xid)Collection<org.infinispan.commons.tx.XidImpl>getPreparedTransactions()TxStategetState(CacheXid xid)booleanisEmpty()voidmarkToCommit(org.infinispan.commons.tx.XidImpl xid, CacheNameCollector collector)voidmarkToRollback(org.infinispan.commons.tx.XidImpl xid, CacheNameCollector collector)voidremove(CacheXid cacheXid)voidrun()periodically checks for idle transactions and rollbacks them.voidstart()voidstop()Statusupdate(CacheXid key, TxFunction function, long timeoutMillis)
-
-
-
Method Detail
-
start
public void start()
- Specified by:
startin interfaceorg.infinispan.commons.api.Lifecycle
-
stop
public void stop()
- Specified by:
stopin interfaceorg.infinispan.commons.api.Lifecycle
-
update
public Status update(CacheXid key, TxFunction function, long timeoutMillis)
-
markToCommit
public void markToCommit(org.infinispan.commons.tx.XidImpl xid, CacheNameCollector collector)
-
markToRollback
public void markToRollback(org.infinispan.commons.tx.XidImpl xid, CacheNameCollector collector)
-
remove
public void remove(CacheXid cacheXid)
-
forgetTransaction
public void forgetTransaction(org.infinispan.commons.tx.XidImpl xid)
-
run
public void run()
periodically checks for idle transactions and rollbacks them.
-
getPreparedTransactions
public Collection<org.infinispan.commons.tx.XidImpl> getPreparedTransactions()
-
isEmpty
public boolean isEmpty()
-
-