org.infinispan.context
Class InvocationContextFlagsOverride

java.lang.Object
  extended by org.infinispan.context.InvocationContextFlagsOverride
All Implemented Interfaces:
Cloneable, EntryLookup, FlagContainer, InvocationContext
Direct Known Subclasses:
TransactionalInvocationContextFlagsOverride

public class InvocationContextFlagsOverride
extends Object
implements InvocationContext

Wraps an existing InvocationContext without changing the context directly but making sure the specified flags are considered enabled.

Since:
5.0
Author:
Sanne Grinovero (C) 2011 Red Hat Inc.

Constructor Summary
InvocationContextFlagsOverride(InvocationContext delegate, Set<Flag> flags)
          Wraps an existing InvocationContext without changing the context directly but making sure the specified flags are considered enabled.
 
Method Summary
 void clearLookedUpEntries()
          Clears the collection of entries looked up
 InvocationContextFlagsOverride clone()
           
 Set<Flag> getFlags()
           
 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.
 BidirectionalMap<Object,CacheEntry> getLookedUpEntries()
          Retrieves a map of entries looked up within the current scope.
 Address getOrigin()
          Get the origin of the command, or null if the command originated locally
 boolean hasFlag(Flag o)
           
 boolean hasLockedKey(Object key)
          Using this method should always ensure locks checked in the appropriate scope.
 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.
 boolean isUseFutureReturnType()
           
 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 reset()
           
 void setFlags(Collection<Flag> newFlags)
           
 void setFlags(Flag... newFlags)
           
 void setUseFutureReturnType(boolean useFutureReturnType)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InvocationContextFlagsOverride

public InvocationContextFlagsOverride(InvocationContext delegate,
                                      Set<Flag> flags)
Wraps an existing InvocationContext without changing the context directly but making sure the specified flags are considered enabled.

Parameters:
delegate -
flags -
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 interface EntryLookup
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.

Specified by:
getLookedUpEntries in interface EntryLookup
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 interface EntryLookup
Parameters:
key - key to store
e - entry to store

putLookedUpEntries

public void putLookedUpEntries(Map<Object,CacheEntry> lookedUpEntries)
Specified by:
putLookedUpEntries in interface EntryLookup

removeLookedUpEntry

public void removeLookedUpEntry(Object key)
Specified by:
removeLookedUpEntry in interface EntryLookup

clearLookedUpEntries

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

Specified by:
clearLookedUpEntries in interface EntryLookup

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
Parameters:
key - lock to test
Returns:
true if the lock being tested is already held in the current scope, false otherwise.

hasFlag

public boolean hasFlag(Flag o)
Specified by:
hasFlag in interface FlagContainer

getFlags

public Set<Flag> getFlags()
Specified by:
getFlags in interface FlagContainer

setFlags

public void setFlags(Flag... newFlags)
Specified by:
setFlags in interface FlagContainer

setFlags

public void setFlags(Collection<Flag> newFlags)
Specified by:
setFlags in interface FlagContainer

reset

public void reset()
Specified by:
reset in interface FlagContainer

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 interface InvocationContext

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 interface InvocationContext

getLockOwner

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

Specified by:
getLockOwner in interface InvocationContext

isUseFutureReturnType

public boolean isUseFutureReturnType()
Specified by:
isUseFutureReturnType in interface InvocationContext

setUseFutureReturnType

public void setUseFutureReturnType(boolean useFutureReturnType)
Specified by:
setUseFutureReturnType in interface InvocationContext

getLockedKeys

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

Specified by:
getLockedKeys in interface InvocationContext

getOrigin

public Address getOrigin()
Description copied from interface: InvocationContext
Get the origin of the command, or null if the command originated locally

Specified by:
getOrigin in interface InvocationContext
Returns:

clone

public InvocationContextFlagsOverride clone()
Specified by:
clone in interface InvocationContext
Overrides:
clone in class Object

-->

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