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
ConstructorDescriptionLocalTransaction
(javax.transaction.Transaction transaction, GlobalTransaction tx, boolean implicitTransaction, int topologyId, long txCreationTime) -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addModification
(org.infinispan.commands.write.WriteCommand mod) void
boolean
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.getIracMetadata
(Object key) javax.transaction.Transaction
int
hashCode()
boolean
hasIracMetadata
(Object key) abstract boolean
boolean
When x-site replication is used, this returns when this operation happens as a result of backing up data from a remote site.boolean
final boolean
boolean
void
locksAcquired
(Collection<Address> nodes) final void
Sets the prepare sent for this transactionvoid
putLookedUpEntries
(Map<Object, CacheEntry> entries) void
putLookedUpEntry
(Object key, CacheEntry e) void
setFromRemoteSite
(boolean fromRemoteSite) void
setStateTransferFlag
(Flag stateTransferFlag) void
storeIracMetadata
(Object key, CompletionStage<IracMetadata> metadata) Stores theIracMetadata
associated 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, setUpdatedEntryVersions
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:
getLookedUpEntries
in interfaceCacheTransaction
- Overrides:
getLookedUpEntries
in 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:
setStateTransferFlag
in 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:
true
if there is anIracMetadata
stored forkey
.
-
storeIracMetadata
Stores theIracMetadata
associated withkey
.- Parameters:
key
- The key.metadata
- TheCompletionStage
that will be completed withIracMetadata
to associate.
-
getIracMetadata
- Returns:
- The
IracMetadata
associated withkey
.
-