org.infinispan.context.impl
Class LocalTxInvocationContext

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

public class LocalTxInvocationContext
extends AbstractTxInvocationContext

Invocation context to be used for locally originated transactions.

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
static BidirectionalLinkedHashMap<Object,CacheEntry> EMPTY_ENTRY_MAP
           
 
Fields inherited from class org.infinispan.context.impl.AbstractInvocationContext
contextFlags, flags
 
Constructor Summary
LocalTxInvocationContext()
           
 
Method Summary
 void clearLookedUpEntries()
          Clears the collection of entries looked up
 AbstractCacheTransaction getCacheTrasaction()
           
 GlobalTransaction getGlobalTransaction()
          Returns the id of the transaction assoctiated with the current call.
 Object getLockOwner()
          Returns the in behalf of which locks will be aquired.
 BidirectionalMap<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.
 Collection<Address> getRemoteLocksAcquired()
           
 boolean hasLockedKey(Object key)
          Using this method should always ensure locks checked in the appropriate scope.
 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 remoteLocksAcquired(Collection<Address> nodes)
           
 void removeLookedUpEntry(Object key)
           
 void setLocalTransaction(LocalTransaction localTransaction)
           
 
Methods inherited from class org.infinispan.context.impl.AbstractTxInvocationContext
addAffectedKeys, getAffectedKeys, getTransaction, hasModifications, isInTxScope, setTransaction
 
Methods inherited from class org.infinispan.context.impl.AbstractInvocationContext
clone, getFlags, getLockedKeys, getOrigin, hasFlag, isContextFlagSet, isFlagsUninitialized, isUseFutureReturnType, reset, setContextFlag, setContextFlag, setFlags, setFlags, setOrigin, setUseFutureReturnType, toString, unsetContextFlag
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.infinispan.context.InvocationContext
clone, getLockedKeys, getOrigin, isUseFutureReturnType, setUseFutureReturnType
 
Methods inherited from interface org.infinispan.context.FlagContainer
getFlags, hasFlag, reset, setFlags, setFlags
 

Field Detail

EMPTY_ENTRY_MAP

public static final BidirectionalLinkedHashMap<Object,CacheEntry> EMPTY_ENTRY_MAP
Constructor Detail

LocalTxInvocationContext

public LocalTxInvocationContext()
Method Detail

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.

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.


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 assoctiated with the current call.


getModifications

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


setLocalTransaction

public void setLocalTransaction(LocalTransaction localTransaction)

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 BidirectionalMap<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

putLookedUpEntries

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

removeLookedUpEntry

public void removeLookedUpEntry(Object key)

clearLookedUpEntries

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


hasLockedKey

public boolean hasLockedKey(Object key)
Description copied from interface: EntryLookup
Using this method should always ensure locks checked in the appropriate scope.

Specified by:
hasLockedKey in interface EntryLookup
Overrides:
hasLockedKey in class AbstractInvocationContext
Parameters:
key - lock to test
Returns:
true if the lock being tested is already held in the current scope, false otherwise.

remoteLocksAcquired

public void remoteLocksAcquired(Collection<Address> nodes)

getRemoteLocksAcquired

public Collection<Address> getRemoteLocksAcquired()

getCacheTrasaction

public AbstractCacheTransaction getCacheTrasaction()
Specified by:
getCacheTrasaction in class AbstractTxInvocationContext

-->

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