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, SingleKeyNonTxInvocationContext

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()
          Clones the invocation context.
 ClassLoader getClassLoader()
          Returns the class loader associated with this invocation
 Set<Flag> getFlags()
           
 Address getOrigin()
          Get the origin of the command, or null if the command originated locally
 boolean hasFlag(Flag o)
           
 boolean hasLockedKey(Object key)
          Returns true if the lock being tested is already held in the current scope, false otherwise.
protected  boolean isContextFlagSet(AbstractInvocationContext.ContextFlag flag)
          Tests whether a context flag is set.
 boolean isFlagsUninitialized()
           
 boolean isUseFutureReturnType()
          Indicates whether the call requires a Future as return type.
 void reset()
           
 void setClassLoader(ClassLoader classLoader)
          Sets the class loader associated for this invocation
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)
          Sets whether the call requires a Future as return type.
 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
addLockedKey, clearLockedKeys, getLockedKeys, 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: InvocationContext
Returns true if the lock being tested is already held in the current scope, false otherwise.

Specified by:
hasLockedKey in interface InvocationContext
Parameters:
key - lock to test

isUseFutureReturnType

public boolean isUseFutureReturnType()
Description copied from interface: InvocationContext
Indicates whether the call requires a Future as return type.

Specified by:
isUseFutureReturnType in interface InvocationContext
Returns:
true if the call requires a Future as return type, false otherwise

setUseFutureReturnType

public void setUseFutureReturnType(boolean useFutureReturnType)
Description copied from interface: InvocationContext
Sets whether the call requires a Future as return type.

Specified by:
setUseFutureReturnType in interface InvocationContext
Parameters:
useFutureReturnType - boolean indicating whether a Future will be needed.

clone

public AbstractInvocationContext clone()
Description copied from interface: InvocationContext
Clones the invocation context.

Specified by:
clone in interface InvocationContext
Overrides:
clone in class Object
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 interface InvocationContext
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 interface InvocationContext

toString

public String toString()
Overrides:
toString in class Object

-->

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