Infinispan Distribution 5.2.6.Final-redhat-2

org.infinispan.context.impl
Class AbstractInvocationContext

java.lang.Object
  extended by org.infinispan.context.impl.AbstractInvocationContext
All Implemented Interfaces:
Cloneable, EntryLookup, 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
           
 
Constructor Summary
AbstractInvocationContext()
           
 
Method Summary
 AbstractInvocationContext clone()
          Clones the invocation context.
 ClassLoader getClassLoader()
          Returns the class loader associated with this invocation
 Address getOrigin()
          Get the origin of the command, or null if the command originated locally
 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 isUseFutureReturnType()
          Indicates whether the call requires a Future as return type.
 boolean replaceValue(Object key, Object value)
          Tries to replace the value of the wrapped entry associated with the given key in the context, if one exists.
 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 setOrigin(Address origin)
           
 void setUseFutureReturnType(boolean useFutureReturnType)
          Sets whether the call requires a Future as return type.
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, toString, 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

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.

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)

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

replaceValue

public boolean replaceValue(Object key,
                            Object value)
Description copied from interface: InvocationContext
Tries to replace the value of the wrapped entry associated with the given key in the context, if one exists.

Specified by:
replaceValue in interface InvocationContext
Returns:
true if the context already contained a wrapped entry for which this value was changed, false otherwise.

Infinispan Distribution 5.2.6.Final-redhat-2

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