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
Object that holds transaction's state on the node where it originated; as opposed to
RemoteTransaction.- 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
ConstructorsConstructorDescriptionLocalTransaction(javax.transaction.Transaction transaction, GlobalTransaction tx, boolean implicitTransaction, int topologyId, long txCreationTime) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddModification(org.infinispan.commands.write.WriteCommand mod) voidbooleangetCommitNodes(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.getIracMetadata(Object key) javax.transaction.TransactioninthashCode()booleanhasIracMetadata(Object key) abstract booleanbooleanWhen x-site replication is used, this returns when this operation happens as a result of backing up data from a remote site.booleanfinal booleanbooleanvoidlocksAcquired(Collection<Address> nodes) final voidSets 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.toString()Methods inherited from class org.infinispan.transaction.impl.AbstractCacheTransaction
addAffectedKey, addAllAffectedKeys, addBackupLockForKey, addListener, addVersionRead, checkIfRolledBack, cleanupBackupLocks, clearLockedKeys, clearLookedUpEntries, forEachBackupLock, forEachLock, freezeModifications, getAffectedKeys, getAllModifications, getBackupLockedKeys, getCreationTime, getGlobalTransaction, getLockedKeys, getModifications, getReleaseFutureForKey, getReleaseFutureForKeys, getStateTransferFlag, getTopologyId, getUpdatedEntryVersions, getVersionsRead, hasModifications, isFromStateTransfer, isMarkedForRollback, lookupEntry, markForRollback, notifyOnTransactionFinished, ownsLock, registerLockedKey, removeBackupLock, removeBackupLocks, removeLookedUpEntry, setModifications, setUpdatedEntryVersionsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.infinispan.transaction.xa.CacheTransaction
hasModification
-
Constructor Details
-
LocalTransaction
public LocalTransaction(javax.transaction.Transaction transaction, GlobalTransaction tx, boolean implicitTransaction, int topologyId, long txCreationTime)
-
-
Method Details
-
addModification
public final void addModification(org.infinispan.commands.write.WriteCommand mod) -
locksAcquired
-
getRemoteLocksAcquired
-
clearRemoteLocksAcquired
public void clearRemoteLocksAcquired() -
getTransaction
public javax.transaction.Transaction getTransaction() -
getLookedUpEntries
- Specified by:
getLookedUpEntriesin interfaceCacheTransaction- Overrides:
getLookedUpEntriesin classAbstractCacheTransaction
-
isImplicitTransaction
public boolean isImplicitTransaction() -
putLookedUpEntry
-
putLookedUpEntries
-
isReadOnly
public boolean isReadOnly() -
isEnlisted
public abstract boolean isEnlisted() -
equals
-
hashCode
public int hashCode() -
toString
-
setStateTransferFlag
- 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:
-
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
-
hasIracMetadata
- Returns:
trueif there is anIracMetadatastored forkey.
-
storeIracMetadata
Stores theIracMetadataassociated withkey.- Parameters:
key- The key.metadata- TheCompletionStagethat will be completed withIracMetadatato associate.
-
getIracMetadata
- Returns:
- The
IracMetadataassociated withkey.
-