org.jboss.cache
Class InvocationContext

java.lang.Object
  extended by org.jboss.cache.InvocationContext
All Implemented Interfaces:
Cloneable

public class InvocationContext
extends Object
implements Cloneable

This context holds information specific to a method invocation.

Author:
Manik Surtani (manik@jboss.org)

Constructor Summary
InvocationContext()
           
 
Method Summary
 void addInvocationLockAcquired(NodeLock l)
           
 void addInvocationLocksAcquired(Collection<NodeLock> locks)
           
 void clearInvocationLocksAcquired()
           
 InvocationContext clone()
           
 boolean equals(Object o)
           
static InvocationContext fromMethodCall(MethodCall methodCall)
          Factory method that creates a context with a given method call.
 long getContextLockAcquisitionTimeout(long defaultFalue)
          If the acq timeout if overwritten for current call, then return that one.
 GlobalTransaction getGlobalTransaction()
          Retrieves the global transaction associated with this invocation
 List<NodeLock> getInvocationLocksAcquired()
           
 MethodCall getMethodCall()
           
 Option getOptionOverrides()
          Retrieves the option overrides associated with this invocation
 Transaction getTransaction()
          Retrieves the transaction associated with this invocation
 int hashCode()
           
 boolean isCacheLoaderHasMods()
          Cache loader might have mods which are different from TX's mods; e.g. when cache is local and passivation is on.
 boolean isLocalRollbackOnly()
           
 boolean isOptionsUninitialised()
           
 boolean isOriginLocal()
          Tests if this invocation originated locally or from a remote cache.
 boolean isTxHasMods()
           
 void reset()
          Resets this to the defaults used when constructing an invocation context object
 void setCacheLoaderHasMods(boolean cacheLoaderHasMods)
           
 void setGlobalTransaction(GlobalTransaction globalTransaction)
          Sets the global transaction associated with this invocation
 void setLocalRollbackOnly(boolean localRollbackOnly)
          Wipe list of previously peeked nodes.
 void setMethodCall(MethodCall methodCall)
          Sets the method call associated with this invocation.
 void setOptionOverrides(Option optionOverrides)
          Sets the option overrides associated with this invocation
 void setOriginLocal(boolean originLocal)
          If set to true, the invocation is assumed to have originated locally.
 void setState(InvocationContext template)
          Sets the state of the InvocationContext based on the template context passed in
 void setTransaction(Transaction transaction)
          Sets the transaction associated with this invocation
 void setTxHasMods(boolean b)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InvocationContext

public InvocationContext()
Method Detail

setLocalRollbackOnly

public void setLocalRollbackOnly(boolean localRollbackOnly)
Wipe list of previously peeked nodes.

Since:
2.1.0

getTransaction

public Transaction getTransaction()
Retrieves the transaction associated with this invocation

Returns:
The transaction associated with this invocation

setTransaction

public void setTransaction(Transaction transaction)
Sets the transaction associated with this invocation

Parameters:
transaction -

getGlobalTransaction

public GlobalTransaction getGlobalTransaction()
Retrieves the global transaction associated with this invocation

Returns:
the global transaction associated with this invocation

setGlobalTransaction

public void setGlobalTransaction(GlobalTransaction globalTransaction)
Sets the global transaction associated with this invocation

Parameters:
globalTransaction -

getOptionOverrides

public Option getOptionOverrides()
Retrieves the option overrides associated with this invocation

Returns:
the option overrides associated with this invocation

isOptionsUninitialised

public boolean isOptionsUninitialised()

setOptionOverrides

public void setOptionOverrides(Option optionOverrides)
Sets the option overrides associated with this invocation

Parameters:
optionOverrides -

isOriginLocal

public boolean isOriginLocal()
Tests if this invocation originated locally or from a remote cache.

Returns:
true if the invocation originated locally.

getInvocationLocksAcquired

public List<NodeLock> getInvocationLocksAcquired()

addInvocationLocksAcquired

public void addInvocationLocksAcquired(Collection<NodeLock> locks)

addInvocationLockAcquired

public void addInvocationLockAcquired(NodeLock l)

clearInvocationLocksAcquired

public void clearInvocationLocksAcquired()

setOriginLocal

public void setOriginLocal(boolean originLocal)
If set to true, the invocation is assumed to have originated locally. If set to false, assumed to have originated from a remote cache.

Parameters:
originLocal -

toString

public String toString()
Overrides:
toString in class Object

isTxHasMods

public boolean isTxHasMods()

setTxHasMods

public void setTxHasMods(boolean b)

isCacheLoaderHasMods

public boolean isCacheLoaderHasMods()
Cache loader might have mods which are different from TX's mods; e.g. when cache is local and passivation is on.


setCacheLoaderHasMods

public void setCacheLoaderHasMods(boolean cacheLoaderHasMods)

isLocalRollbackOnly

public boolean isLocalRollbackOnly()

reset

public void reset()
Resets this to the defaults used when constructing an invocation context object


clone

public InvocationContext clone()
                        throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

setState

public void setState(InvocationContext template)
Sets the state of the InvocationContext based on the template context passed in

Parameters:
template -

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getMethodCall

public MethodCall getMethodCall()
Returns:
the method call associated with this invocation

setMethodCall

public void setMethodCall(MethodCall methodCall)
Sets the method call associated with this invocation.

Parameters:
methodCall - methodcall to set

fromMethodCall

public static InvocationContext fromMethodCall(MethodCall methodCall)
Factory method that creates a context with a given method call.

Parameters:
methodCall - methodcall to use
Returns:
invocation context

getContextLockAcquisitionTimeout

public long getContextLockAcquisitionTimeout(long defaultFalue)
If the acq timeout if overwritten for current call, then return that one. If not overwritten return default value.



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