org.infinispan.context.impl
Class AbstractInvocationContext

java.lang.Object
  extended by org.infinispan.context.impl.AbstractInvocationContext
All Implemented Interfaces:
Cloneable, EntryLookup, FlagContainer, InvocationContext
Direct Known Subclasses:
AbstractTxInvocationContext, NonTxInvocationContext

public abstract class AbstractInvocationContext
extends Object
implements InvocationContext

Common features of transaction and invocation contexts

Since:
4.0
Author:
Manik Surtani, Mircea.Markus@jboss.com

Nested Class Summary
protected static class AbstractInvocationContext.ContextFlag
           
 
Field Summary
protected  byte contextFlags
           
protected  EnumSet<Flag> flags
           
 
Constructor Summary
AbstractInvocationContext()
           
 
Method Summary
 AbstractInvocationContext clone()
           
 Set<Flag> getFlags()
           
 Set<Object> getLockedKeys()
          Returns the set of keys that are locked for writing.
 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.
protected  boolean isContextFlagSet(AbstractInvocationContext.ContextFlag flag)
          Tests whether a context flag is set.
 boolean isFlagsUninitialized()
           
 boolean isUseFutureReturnType()
           
 void reset()
           
protected  void setContextFlag(AbstractInvocationContext.ContextFlag flag)
          Utility method that sets a given context flag.
protected  void setContextFlag(AbstractInvocationContext.ContextFlag flag, boolean set)
          Utility value that sets or un-sets a context flag based on a boolean passed in
 void setFlags(Collection<Flag> flags)
           
 void setFlags(Flag... flags)
           
 void setOrigin(Address origin)
           
 void setUseFutureReturnType(boolean useFutureReturnType)
           
 String toString()
           
protected  void unsetContextFlag(AbstractInvocationContext.ContextFlag flag)
          Utility method that un-sets a context flag.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.infinispan.context.InvocationContext
getLockOwner, isInTxScope, isOriginLocal
 
Methods inherited from interface org.infinispan.context.EntryLookup
clearLookedUpEntries, getLookedUpEntries, lookupEntry, putLookedUpEntries, putLookedUpEntry, removeLookedUpEntry
 

Field Detail

flags

protected EnumSet<Flag> flags

contextFlags

protected byte contextFlags
Constructor Detail

AbstractInvocationContext

public AbstractInvocationContext()
Method Detail

isContextFlagSet

protected final boolean isContextFlagSet(AbstractInvocationContext.ContextFlag flag)
Tests whether a context flag is set.

Parameters:
flag - context flag to test
Returns:
true if set, false otherwise.

setContextFlag

protected final void setContextFlag(AbstractInvocationContext.ContextFlag flag)
Utility method that sets a given context flag.

Parameters:
flag - context flag to set

unsetContextFlag

protected final void unsetContextFlag(AbstractInvocationContext.ContextFlag flag)
Utility method that un-sets a context flag.

Parameters:
flag - context flag to unset

setContextFlag

protected final void setContextFlag(AbstractInvocationContext.ContextFlag flag,
                                    boolean set)
Utility value that sets or un-sets a context flag based on a boolean passed in

Parameters:
flag - flag to set or unset
set - if true, the context flag is set. If false, the context flag is unset.

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... flags)
Specified by:
setFlags in interface FlagContainer

setFlags

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

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:

setOrigin

public void setOrigin(Address origin)

reset

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

isFlagsUninitialized

public boolean isFlagsUninitialized()

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.

isUseFutureReturnType

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

setUseFutureReturnType

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

clone

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

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

toString

public String toString()
Overrides:
toString in class Object

-->

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