org.infinispan.context.impl
Class RemoteTxInvocationContext

java.lang.Object
  extended by org.infinispan.context.impl.AbstractInvocationContext
      extended by org.infinispan.context.impl.AbstractTxInvocationContext
          extended by org.infinispan.context.impl.RemoteTxInvocationContext
All Implemented Interfaces:
Cloneable, EntryLookup, FlagContainer, TxInvocationContext, InvocationContext

public class RemoteTxInvocationContext
extends AbstractTxInvocationContext

Context to be used for transaction that originated remotely.

Since:
4.0
Author:
Mircea.Markus@jboss.com, Galder ZamarreƱo

Nested Class Summary
 
Nested classes/interfaces inherited from class org.infinispan.context.impl.AbstractInvocationContext
AbstractInvocationContext.ContextFlag
 
Field Summary
 
Fields inherited from class org.infinispan.context.impl.AbstractInvocationContext
contextFlags, flags
 
Constructor Summary
RemoteTxInvocationContext()
           
 
Method Summary
 void addLockedKey(Object key)
          Tracks the given key as locked by this invocation context.
 void clearLookedUpEntries()
          Clears the collection of entries looked up
 RemoteTxInvocationContext clone()
          Clones the invocation context.
 boolean equals(Object o)
           
 AbstractCacheTransaction getCacheTransaction()
           
 GlobalTransaction getGlobalTransaction()
          Returns the id of the transaction associated with the current call.
 Set<Object> getLockedKeys()
          Returns the set of keys that are locked for writing.
 Object getLockOwner()
          Returns the in behalf of which locks will be aquired.
 Map<Object,CacheEntry> getLookedUpEntries()
          Retrieves a map of entries looked up within the current scope.
 List<WriteCommand> getModifications()
          Returns all the modifications performed in the scope of the current transaction.
 Transaction getTransaction()
          Returns the tx associated with the current thread.
 int hashCode()
           
 boolean isOriginLocal()
          Returns true if the call was originated locally, false if it is the result of a remote rpc.
 boolean isTransactionValid()
           
 CacheEntry lookupEntry(Object key)
          Retrieves an entry from the collection of looked up entries in the current scope.
 void putLookedUpEntries(Map<Object,CacheEntry> lookedUpEntries)
           
 void putLookedUpEntry(Object key, CacheEntry e)
          Puts an entry in the registry of looked up entries in the current scope.
 void removeLookedUpEntry(Object key)
           
 void setRemoteTransaction(RemoteTransaction remoteTransaction)
           
 
Methods inherited from class org.infinispan.context.impl.AbstractTxInvocationContext
addAffectedKey, addAllAffectedKeys, clearLockedKeys, getAffectedKeys, hasModifications, isImplicitTransaction, isInTxScope, reset, setImplicitTransaction, setTransaction
 
Methods inherited from class org.infinispan.context.impl.AbstractInvocationContext
getClassLoader, getFlags, getOrigin, hasFlag, hasLockedKey, isContextFlagSet, isFlagsUninitialized, isUseFutureReturnType, setClassLoader, setContextFlag, setContextFlag, setFlags, setFlags, setOrigin, setUseFutureReturnType, toString, unsetContextFlag
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.infinispan.context.InvocationContext
getClassLoader, getOrigin, hasLockedKey, isUseFutureReturnType, setClassLoader, setUseFutureReturnType
 
Methods inherited from interface org.infinispan.context.FlagContainer
getFlags, hasFlag, setFlags, setFlags
 

Constructor Detail

RemoteTxInvocationContext

public RemoteTxInvocationContext()
Method Detail

getTransaction

public Transaction getTransaction()
Description copied from interface: TxInvocationContext
Returns the tx associated with the current thread. This method MUST be guarded with a call to InvocationContext.isOriginLocal(), as Transaction are not propagated from the node where tx was started.

Specified by:
getTransaction in interface TxInvocationContext
Overrides:
getTransaction in class AbstractTxInvocationContext

isTransactionValid

public boolean isTransactionValid()
Returns:
true if the current transaction is in a valid state to perform operations on (i.e.,RUNNING or PREPARING) or false otherwise.

getLockOwner

public Object getLockOwner()
Description copied from interface: InvocationContext
Returns the in behalf of which locks will be aquired.


getGlobalTransaction

public GlobalTransaction getGlobalTransaction()
Description copied from interface: TxInvocationContext
Returns the id of the transaction associated with the current call.


isOriginLocal

public boolean isOriginLocal()
Description copied from interface: InvocationContext
Returns true if the call was originated locally, false if it is the result of a remote rpc.


getModifications

public List<WriteCommand> getModifications()
Description copied from interface: TxInvocationContext
Returns all the modifications performed in the scope of the current transaction.


setRemoteTransaction

public void setRemoteTransaction(RemoteTransaction remoteTransaction)

lookupEntry

public CacheEntry lookupEntry(Object key)
Description copied from interface: EntryLookup
Retrieves an entry from the collection of looked up entries in the current scope.

Parameters:
key - key to look up
Returns:
an entry, or null if it cannot be found.

getLookedUpEntries

public Map<Object,CacheEntry> getLookedUpEntries()
Description copied from interface: EntryLookup
Retrieves a map of entries looked up within the current scope.

Returns:
a map of looked up entries.

putLookedUpEntry

public void putLookedUpEntry(Object key,
                             CacheEntry e)
Description copied from interface: EntryLookup
Puts an entry in the registry of looked up entries in the current scope.

Parameters:
key - key to store
e - entry to store

removeLookedUpEntry

public void removeLookedUpEntry(Object key)

clearLookedUpEntries

public void clearLookedUpEntries()
Description copied from interface: EntryLookup
Clears the collection of entries looked up


putLookedUpEntries

public void putLookedUpEntries(Map<Object,CacheEntry> lookedUpEntries)

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

clone

public RemoteTxInvocationContext clone()
Description copied from interface: InvocationContext
Clones the invocation context.

Specified by:
clone in interface InvocationContext
Overrides:
clone in class AbstractInvocationContext
Returns:
A cloned instance of this invocation context instance

getCacheTransaction

public AbstractCacheTransaction getCacheTransaction()
Specified by:
getCacheTransaction in interface TxInvocationContext
Specified by:
getCacheTransaction in class AbstractTxInvocationContext

getLockedKeys

public Set<Object> getLockedKeys()
Description copied from interface: InvocationContext
Returns the set of keys that are locked for writing.


addLockedKey

public void addLockedKey(Object key)
Description copied from interface: InvocationContext
Tracks the given key as locked by this invocation context.


-->

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