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()
           
 boolean hasFlag(Flag o)
           
 boolean hasLockedEntries()
          Returns true if the context has any locked entries associated with it.
 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 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 volatile 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

reset

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

isFlagsUninitialized

public boolean isFlagsUninitialized()
Specified by:
isFlagsUninitialized in interface FlagContainer

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.

hasLockedEntries

public boolean hasLockedEntries()
Description copied from interface: InvocationContext
Returns true if the context has any locked entries associated with it.

Specified by:
hasLockedEntries 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

clone

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

toString

public String toString()
Overrides:
toString in class Object

Google Analytics

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