Package org.infinispan.context.impl
Class ImmutableContext
- java.lang.Object
-
- org.infinispan.context.impl.ImmutableContext
-
- All Implemented Interfaces:
Cloneable
,EntryLookup
,InvocationContext
public final class ImmutableContext extends Object implements InvocationContext
This context is a non-context for operations such as eviction which are not related to the method invocation which caused them.- Author:
- Sanne Grinovero
(C) 2011 Red Hat Inc.
-
-
Field Summary
Fields Modifier and Type Field Description static ImmutableContext
INSTANCE
-
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()
InvocationContext
clone()
Clones the invocation context.ClassLoader
getClassLoader()
Returns the class loader associated with this invocationSet<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.Address
getOrigin()
boolean
hasLockedKey(Object key)
Returns true if the lock being tested is already held in the current scope, false otherwise.boolean
isEntryRemovedInContext(Object key)
boolean
isInTxScope()
Returns true if this call is performed in the context of an transaction, false otherwise.boolean
isOriginLocal()
Returns true if the call was originated locally, false if it is the result of a remote rpc.CacheEntry
lookupEntry(Object key)
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
setClassLoader(ClassLoader classLoader)
Sets the class loader associated for this invocationvoid
setLockOwner(Object lockOwner)
Sets the object to be used by lock owner.-
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
forEachEntry, forEachValue, lookedUpEntriesCount, removeLookedUpEntries
-
Methods inherited from interface org.infinispan.context.InvocationContext
replaceValue
-
-
-
-
Field Detail
-
INSTANCE
public static final ImmutableContext INSTANCE
-
-
Method Detail
-
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.- Specified by:
lookupEntry
in interfaceEntryLookup
- 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. Note: The key inside the CacheEntry may benull
if the key does not exist in the cache.- Specified by:
getLookedUpEntries
in interfaceEntryLookup
- 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.- Specified by:
putLookedUpEntry
in interfaceEntryLookup
- Parameters:
key
- key to storee
- entry to store
-
removeLookedUpEntry
public void removeLookedUpEntry(Object key)
- Specified by:
removeLookedUpEntry
in interfaceEntryLookup
-
hasLockedKey
public boolean hasLockedKey(Object key)
Description copied from interface:InvocationContext
Returns true if the lock being tested is already held in the current scope, false otherwise.- Specified by:
hasLockedKey
in interfaceInvocationContext
- Parameters:
key
- lock to test
-
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.- Specified by:
isOriginLocal
in interfaceInvocationContext
-
getOrigin
public Address getOrigin()
- Specified by:
getOrigin
in interfaceInvocationContext
- Returns:
- the origin of the command, or null if the command originated locally
-
isInTxScope
public boolean isInTxScope()
Description copied from interface:InvocationContext
Returns true if this call is performed in the context of an transaction, false otherwise.- Specified by:
isInTxScope
in interfaceInvocationContext
-
getLockOwner
public Object getLockOwner()
Description copied from interface:InvocationContext
Returns the in behalf of which locks will be acquired.- Specified by:
getLockOwner
in interfaceInvocationContext
-
setLockOwner
public void setLockOwner(Object lockOwner)
Description copied from interface:InvocationContext
Sets the object to be used by lock owner.- Specified by:
setLockOwner
in interfaceInvocationContext
-
getLockedKeys
public Set<Object> getLockedKeys()
Description copied from interface:InvocationContext
Returns the set of keys that are locked for writing.- Specified by:
getLockedKeys
in interfaceInvocationContext
-
clone
public InvocationContext clone()
Description copied from interface:InvocationContext
Clones the invocation context.- Specified by:
clone
in interfaceInvocationContext
- Overrides:
clone
in classObject
- Returns:
- A cloned instance of this invocation context instance
-
getClassLoader
public ClassLoader getClassLoader()
Description copied from interface:InvocationContext
Returns the class loader associated with this invocation- Specified by:
getClassLoader
in interfaceInvocationContext
- Returns:
- a class loader instance or null if no class loader was specifically associated
-
setClassLoader
public void setClassLoader(ClassLoader classLoader)
Description copied from interface:InvocationContext
Sets the class loader associated for this invocation- Specified by:
setClassLoader
in interfaceInvocationContext
-
addLockedKey
public void addLockedKey(Object key)
Description copied from interface:InvocationContext
Tracks the given key as locked by this invocation context.- Specified by:
addLockedKey
in interfaceInvocationContext
-
clearLockedKeys
public void clearLockedKeys()
- Specified by:
clearLockedKeys
in interfaceInvocationContext
-
isEntryRemovedInContext
public boolean isEntryRemovedInContext(Object key)
- Specified by:
isEntryRemovedInContext
in interfaceInvocationContext
-
-