Package org.infinispan.context.impl
Class NonTxInvocationContext
- java.lang.Object
-
- org.infinispan.context.impl.AbstractInvocationContext
-
- org.infinispan.context.impl.NonTxInvocationContext
-
- All Implemented Interfaces:
Cloneable
,EntryLookup
,InvocationContext
public class NonTxInvocationContext extends AbstractInvocationContext
Context to be used for non transactional calls, both remote and local.- Since:
- 4.0
- Author:
- Mircea.Markus@jboss.com
-
-
Constructor Summary
Constructors Constructor Description NonTxInvocationContext(int numEntries, Address origin)
NonTxInvocationContext(Address origin)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLockedKey(Object key)
Tracks the given key as locked by this invocation context.void
clearLockedKeys()
NonTxInvocationContext
clone()
Clones the invocation context.void
forEachEntry(BiConsumer<Object,CacheEntry> action)
Execute an action for each entry in the context.Set<Object>
getLockedKeys()
Returns the set of keys that are locked for writing.Object
getLockOwner()
Returns the in behalf of which locks will be acquired.Map<Object,CacheEntry>
getLookedUpEntries()
Retrieves a map of entries looked up within the current scope.boolean
isInTxScope()
Returns true if this call is performed in the context of an transaction, false otherwise.int
lookedUpEntriesCount()
CacheEntry
lookupEntry(Object k)
Retrieves an entry from the collection of looked up entries in the current scope.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
setLockOwner(Object lockOwner)
Sets the object to be used by lock owner.-
Methods inherited from class org.infinispan.context.impl.AbstractInvocationContext
getClassLoader, getOrigin, hasLockedKey, isEntryRemovedInContext, isOriginLocal, onEntryValueReplaced, setClassLoader
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.infinispan.context.EntryLookup
forEachValue, removeLookedUpEntries
-
Methods inherited from interface org.infinispan.context.InvocationContext
replaceValue
-
-
-
-
Method Detail
-
lookupEntry
public CacheEntry lookupEntry(Object k)
Description copied from interface:EntryLookup
Retrieves an entry from the collection of looked up entries in the current scope.- Parameters:
k
- key to look up- Returns:
- an entry, or null if it cannot be found.
-
removeLookedUpEntry
public void removeLookedUpEntry(Object key)
-
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 storee
- entry to store
-
getLookedUpEntries
public Map<Object,CacheEntry> getLookedUpEntries()
Description copied from interface:EntryLookup
Retrieves a map of entries looked up within the current scope. Note: The key inside the CacheEntry may benull
if the key does not exist in the cache.- Returns:
- a map of looked up entries.
-
forEachEntry
public void forEachEntry(BiConsumer<Object,CacheEntry> action)
Description copied from interface:EntryLookup
Execute an action for each entry in the context. Includes invalid entries, which have anull
value and may also report anull
key.
-
lookedUpEntriesCount
public int lookedUpEntriesCount()
- Returns:
- The number of entries wrapped in the context, including invalid entries.
-
isInTxScope
public boolean isInTxScope()
Description copied from interface:InvocationContext
Returns true if this call is performed in the context of an transaction, false otherwise.
-
getLockOwner
public Object getLockOwner()
Description copied from interface:InvocationContext
Returns the in behalf of which locks will be acquired.
-
setLockOwner
public void setLockOwner(Object lockOwner)
Description copied from interface:InvocationContext
Sets the object to be used by lock owner.
-
clone
public NonTxInvocationContext clone()
Description copied from interface:InvocationContext
Clones the invocation context.- Specified by:
clone
in interfaceInvocationContext
- Overrides:
clone
in classAbstractInvocationContext
- Returns:
- A cloned instance of this invocation context instance
-
addLockedKey
public void addLockedKey(Object key)
Description copied from interface:InvocationContext
Tracks the given key as locked by this invocation context.
-
getLockedKeys
public Set<Object> getLockedKeys()
Description copied from interface:InvocationContext
Returns the set of keys that are locked for writing.
-
clearLockedKeys
public void clearLockedKeys()
-
-