org.infinispan.transaction
Class LocalTransaction

java.lang.Object
  extended by org.infinispan.transaction.AbstractCacheTransaction
      extended by org.infinispan.transaction.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 to RemoteTransaction.

Since:
5.0
Author:
Mircea.Markus@jboss.com, Pedro Ruivo

Field Summary
 
Fields inherited from class org.infinispan.transaction.AbstractCacheTransaction
affectedKeys, backupKeyLocks, hasLocalOnlyModifications, keyEquivalence, lockedKeys, lookedUpEntries, modifications, topologyId, tx
 
Constructor Summary
LocalTransaction(Transaction transaction, GlobalTransaction tx, boolean implicitTransaction, int topologyId, Equivalence<Object> keyEquivalence)
           
 
Method Summary
 void addModification(WriteCommand mod)
           
 void addReadKey(Object key)
           
 void clearRemoteLocksAcquired()
           
 boolean equals(Object o)
           
 Collection<Address> getCommitNodes(Collection<Address> recipients, int currentTopologyId, Collection<Address> members)
          Calculates the list of nodes to which a commit/rollback needs to be sent based on the nodes to which prepare was sent.
 Map<Object,CacheEntry> getLookedUpEntries()
           
 Collection<Address> getRemoteLocksAcquired()
           
 Transaction getTransaction()
           
 int hashCode()
           
 boolean isCommitOrRollbackSent()
           
abstract  boolean isEnlisted()
           
 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.
 boolean isFromStateTransfer()
           
 boolean isImplicitTransaction()
           
 boolean isPrepareSent()
           
 boolean isReadOnly()
           
 boolean keyRead(Object key)
           
 void locksAcquired(Collection<Address> nodes)
           
 void markCommitOrRollbackSent()
          Sets the commit or rollback sent for this transaction
 void markPrepareSent()
          Sets the prepare sent for this transaction
 void putLookedUpEntries(Map<Object,CacheEntry> entries)
           
 void putLookedUpEntry(Object key, CacheEntry e)
           
 void setFromRemoteSite(boolean fromRemoteSite)
           
 void setFromStateTransfer(boolean isFromStateTransfer)
           
 String toString()
           
 
Methods inherited from class org.infinispan.transaction.AbstractCacheTransaction
addAffectedKey, addAllAffectedKeys, addBackupLockForKey, clearLockedKeys, clearLookedUpEntries, getAffectedKeys, getAllModifications, getBackupLockedKeys, getGlobalTransaction, getLockedKeys, getLookedUpRemoteVersion, getModifications, getTopologyId, getUpdatedEntryVersions, hasModification, isMarkedForRollback, lookupEntry, markForRollback, notifyOnTransactionFinished, ownsLock, putLookedUpRemoteVersion, registerLockedKey, removeLookedUpEntry, setModifications, setUpdatedEntryVersions, waitForLockRelease
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalTransaction

public LocalTransaction(Transaction transaction,
                        GlobalTransaction tx,
                        boolean implicitTransaction,
                        int topologyId,
                        Equivalence<Object> keyEquivalence)
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:
getLookedUpEntries in interface CacheTransaction
Overrides:
getLookedUpEntries in class AbstractCacheTransaction

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()

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

addReadKey

public void addReadKey(Object key)
Specified by:
addReadKey in interface CacheTransaction
Overrides:
addReadKey in class AbstractCacheTransaction

keyRead

public boolean keyRead(Object key)
Specified by:
keyRead in interface CacheTransaction
Overrides:
keyRead in class AbstractCacheTransaction

isFromStateTransfer

public boolean isFromStateTransfer()

setFromStateTransfer

public void setFromStateTransfer(boolean isFromStateTransfer)

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,
                                          int currentTopologyId,
                                          Collection<Address> members)
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' and getRemoteLocksAcquired() 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

-->

Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.