Package org.infinispan.transaction.impl
Class LocalTransaction
- java.lang.Object
-
- org.infinispan.transaction.impl.AbstractCacheTransaction
-
- org.infinispan.transaction.impl.LocalTransaction
-
- All Implemented Interfaces:
CacheTransaction
- Direct Known Subclasses:
LocalXaTransaction,SyncLocalTransaction
public abstract class LocalTransaction extends AbstractCacheTransaction
Object that holds transaction's state on the node where it originated; as opposed toRemoteTransaction.- Since:
- 5.0
- Author:
- Mircea.Markus@jboss.com, Pedro Ruivo
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.infinispan.transaction.xa.CacheTransaction
CacheTransaction.TransactionCompletedListener
-
-
Field Summary
-
Fields inherited from class org.infinispan.transaction.impl.AbstractCacheTransaction
affectedKeys, lookedUpEntries, modifications, topologyId, tx
-
-
Constructor Summary
Constructors Constructor Description LocalTransaction(Transaction transaction, GlobalTransaction tx, boolean implicitTransaction, int topologyId, long txCreationTime)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddModification(WriteCommand mod)voidclearRemoteLocksAcquired()booleanequals(Object o)Collection<Address>getCommitNodes(Collection<Address> recipients, CacheTopology cacheTopology)Calculates the list of nodes to which a commit/rollback needs to be sent based on the nodes to which prepare was sent.CompletionStage<IracMetadata>getIracMetadata(Object key)Map<Object,CacheEntry>getLookedUpEntries()Collection<Address>getRemoteLocksAcquired()TransactiongetTransaction()inthashCode()booleanhasIracMetadata(Object key)booleanisCommitOrRollbackSent()abstract booleanisEnlisted()booleanisFromRemoteSite()When x-site replication is used, this returns when this operation happens as a result of backing up data from a remote site.booleanisImplicitTransaction()booleanisPrepareSent()booleanisReadOnly()voidlocksAcquired(Collection<Address> nodes)voidmarkCommitOrRollbackSent()Sets the commit or rollback sent for this transactionvoidmarkPrepareSent()Sets the prepare sent for this transactionvoidputLookedUpEntries(Map<Object,CacheEntry> entries)voidputLookedUpEntry(Object key, CacheEntry e)voidsetFromRemoteSite(boolean fromRemoteSite)voidsetStateTransferFlag(Flag stateTransferFlag)voidstoreIracMetadata(Object key, CompletionStage<IracMetadata> metadata)Stores theIracMetadataassociated withkey.StringtoString()-
Methods inherited from class org.infinispan.transaction.impl.AbstractCacheTransaction
addAffectedKey, addAllAffectedKeys, addBackupLockForKey, addListener, addVersionRead, cleanupBackupLocks, clearLockedKeys, clearLookedUpEntries, forEachBackupLock, forEachLock, freezeModifications, getAffectedKeys, getAllModifications, getBackupLockedKeys, getCreationTime, getGlobalTransaction, getLockedKeys, getModifications, getReleaseFutureForKey, getReleaseFutureForKeys, getStateTransferFlag, getTopologyId, getUpdatedEntryVersions, getVersionsRead, hasModification, isFromStateTransfer, isMarkedForRollback, lookupEntry, markForRollback, notifyOnTransactionFinished, ownsLock, registerLockedKey, removeBackupLock, removeBackupLocks, removeLookedUpEntry, setModifications, setUpdatedEntryVersions
-
-
-
-
Constructor Detail
-
LocalTransaction
public LocalTransaction(Transaction transaction, GlobalTransaction tx, boolean implicitTransaction, int topologyId, long txCreationTime)
-
-
Method Detail
-
addModification
public final void addModification(WriteCommand mod)
-
locksAcquired
public void locksAcquired(Collection<Address> nodes)
-
getRemoteLocksAcquired
public Collection<Address> getRemoteLocksAcquired()
-
clearRemoteLocksAcquired
public void clearRemoteLocksAcquired()
-
getTransaction
public Transaction getTransaction()
-
getLookedUpEntries
public Map<Object,CacheEntry> getLookedUpEntries()
- Specified by:
getLookedUpEntriesin interfaceCacheTransaction- Overrides:
getLookedUpEntriesin classAbstractCacheTransaction
-
isImplicitTransaction
public boolean isImplicitTransaction()
-
putLookedUpEntry
public void putLookedUpEntry(Object key, CacheEntry e)
-
putLookedUpEntries
public void putLookedUpEntries(Map<Object,CacheEntry> entries)
-
isReadOnly
public boolean isReadOnly()
-
isEnlisted
public abstract boolean isEnlisted()
-
setStateTransferFlag
public void setStateTransferFlag(Flag stateTransferFlag)
- Specified by:
setStateTransferFlagin classAbstractCacheTransaction
-
isFromRemoteSite
public boolean isFromRemoteSite()
When x-site replication is used, this returns when this operation happens as a result of backing up data from a remote site.
-
setFromRemoteSite
public void setFromRemoteSite(boolean fromRemoteSite)
- See Also:
isFromRemoteSite()
-
getCommitNodes
public Collection<Address> getCommitNodes(Collection<Address> recipients, CacheTopology cacheTopology)
Calculates the list of nodes to which a commit/rollback needs to be sent based on the nodes to which prepare was sent. If the commit/rollback is to be sent in the same topologyId, then the 'recipients' param is returned back. If the current topologyId is different than the topologyId of this transaction (AbstractCacheTransaction.getTopologyId()then this method returns the reunion between 'recipients' andgetRemoteLocksAcquired()from which it discards the members that left.
-
markPrepareSent
public final void markPrepareSent()
Sets the prepare sent for this transaction
-
isPrepareSent
public final boolean isPrepareSent()
- Returns:
- true if the prepare was sent to the other nodes
-
markCommitOrRollbackSent
public final void markCommitOrRollbackSent()
Sets the commit or rollback sent for this transaction
-
isCommitOrRollbackSent
public final boolean isCommitOrRollbackSent()
- Returns:
- true if the commit or rollback was sent to the other nodes
-
hasIracMetadata
public boolean hasIracMetadata(Object key)
- Returns:
trueif there is anIracMetadatastored forkey.
-
storeIracMetadata
public void storeIracMetadata(Object key, CompletionStage<IracMetadata> metadata)
Stores theIracMetadataassociated withkey.- Parameters:
key- The key.metadata- TheCompletionStagethat will be completed withIracMetadatato associate.
-
getIracMetadata
public CompletionStage<IracMetadata> getIracMetadata(Object key)
- Returns:
- The
IracMetadataassociated withkey.
-
-