|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.cache.InvocationContext
public abstract class InvocationContext
A context that holds information regarding the scope of a single invocation. May delegate some calls to a TransactionContext
if one is in scope.
Note that prior to 3.0.0, InvocationContext was a concrete class and not an abstract one.
TransactionContext
Field Summary | |
---|---|
protected LinkedHashSet |
invocationLocks
LinkedHashSet of locks acquired by the invocation. |
protected TransactionContext |
transactionContext
|
Constructor Summary | |
---|---|
InvocationContext()
|
Method Summary | |
---|---|
void |
addAllLocks(List locks)
Adds a List of locks to the currently maintained collection of locks acquired. |
void |
addFqnLoaded(Fqn fqn)
Adds an Fqn to the set of Fqns loaded by the cache loader interceptor. |
void |
addLock(Object lock)
Adds a lock to the currently maintained collection of locks acquired. |
void |
clearLocks()
Clears all locks from the currently maintained collection of locks acquired. |
abstract void |
clearLookedUpNodes()
Clears the registry of looked up nodes. |
abstract InvocationContext |
copy()
This is a "copy-factory-method" that should be used whenever a clone of this class is needed. |
protected void |
doCopy(InvocationContext copy)
|
boolean |
equals(Object o)
|
VisitableCommand |
getCommand()
Deprecated. |
Set<Fqn> |
getFqnsLoaded()
|
GlobalTransaction |
getGlobalTransaction()
Retrieves the global transaction associated with this invocation |
long |
getLockAcquisitionTimeout(long timeout)
If the lock acquisition timeout is overridden for current call using an option, then return that one. |
List |
getLocks()
Returns an immutable, defensive copy of the List of locks currently maintained for the current scope. |
abstract Map<Fqn,NodeSPI> |
getLookedUpNodes()
Retrieves a map of nodes looked up within the current invocation's scope. |
MethodCall |
getMethodCall()
Deprecated. |
Option |
getOptionOverrides()
Retrieves the option overrides associated with this invocation |
Transaction |
getTransaction()
Retrieves the transaction associated with this invocation |
TransactionContext |
getTransactionContext()
|
int |
hashCode()
|
boolean |
hasLock(Object lock)
Note that if a transaction is in scope, implementations should test this lock from on TransactionContext . |
boolean |
isLocalRollbackOnly()
|
boolean |
isLockingSuppressed()
|
boolean |
isOptionsUninitialised()
|
boolean |
isOriginLocal()
Tests if this invocation originated locally or from a remote cache. |
boolean |
isValidTransaction()
|
abstract NodeSPI |
lookUpNode(Fqn fqn)
Retrieves a node from the registry of looked up nodes in the current scope. |
abstract void |
putLookedUpNode(Fqn f,
NodeSPI n)
Puts an entry in the registry of looked up nodes in the current scope. |
abstract void |
putLookedUpNodes(Map<Fqn,NodeSPI> lookedUpNodes)
Adds a map of looked up nodes to the current map of looked up nodes |
void |
removeLock(Object lock)
Removes a lock from the currently maintained collection of locks acquired. |
void |
reset()
Resets the context, freeing up any references. |
void |
setCommand(VisitableCommand cacheCommand)
Deprecated. |
void |
setFqnsLoaded(Set<Fqn> fqnsLoaded)
|
void |
setGlobalTransaction(GlobalTransaction globalTransaction)
Sets the global transaction associated with this invocation |
void |
setLocalRollbackOnly(boolean localRollbackOnly)
Marks teh context as only rolling back. |
void |
setMethodCall(MethodCall methodCall)
Deprecated. not used anymore. Interceptors will get a ReplicableCommand instance passed in along with an InvocationContext. |
void |
setOptionOverrides(Option optionOverrides)
Sets the option overrides to be 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 a transaction object on the invocation context. |
void |
setTransactionContext(TransactionContext transactionContext)
Sets the transaction context to be associated with the current thread. |
void |
throwIfNeeded(Throwable e)
Throws the given throwable provided no options suppress or prevent this from happening. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected TransactionContext transactionContext
protected LinkedHashSet invocationLocks
This needs to be unchecked since we support both MVCC (Fqns held here) or legacy Opt/Pess locking (NodeLocks held here). once we drop support for opt/pess locks we can genericise this to contain Fqns. - Manik Surtani, June 2008
Constructor Detail |
---|
public InvocationContext()
Method Detail |
---|
public abstract NodeSPI lookUpNode(Fqn fqn)
fqn
- fqn to look up
public abstract void putLookedUpNode(Fqn f, NodeSPI n)
f
- fqn to addn
- node to addpublic abstract void putLookedUpNodes(Map<Fqn,NodeSPI> lookedUpNodes)
lookedUpNodes
- looked up nodes to addpublic abstract void clearLookedUpNodes()
public abstract Map<Fqn,NodeSPI> getLookedUpNodes()
public void setLocalRollbackOnly(boolean localRollbackOnly)
localRollbackOnly
- if true, the context is only rolling back.public Transaction getTransaction()
public void setTransaction(Transaction transaction)
transaction
- transaction to setpublic TransactionContext getTransactionContext()
public void setTransactionContext(TransactionContext transactionContext)
transactionContext
- transaction context to setpublic GlobalTransaction getGlobalTransaction()
public void setGlobalTransaction(GlobalTransaction globalTransaction)
globalTransaction
- global transaction to setpublic Option getOptionOverrides()
public boolean isOptionsUninitialised()
public void setOptionOverrides(Option optionOverrides)
optionOverrides
- options to setpublic boolean isOriginLocal()
public List getLocks()
Note that if a transaction is in scope, implementations should retrieve these locks from the TransactionContext
.
Retrieving locks from this method should always ensure they are retrieved from the appropriate scope.
Note that currently (as of 3.0.0) this list is unchecked. This is to allow support for both MVCC (which uses Fqns as locks)
as well as legacy Optimistic and Pessimistic Locking schemes (which use NodeLock
as locks). Once support for
legacy node locking schemes are dropped, this method will be more strongly typed to return List
public void addAllLocks(List locks)
Note that if a transaction is in scope, implementations should record locks on the TransactionContext
.
Adding locks using this method should always ensure they are applied to the appropriate scope.
Note that currently (as of 3.0.0) this list is unchecked. This is to allow support for both MVCC (which uses Fqns as locks)
as well as legacy Optimistic and Pessimistic Locking schemes (which use NodeLock
as locks). Once support for
legacy node locking schemes are dropped, this method will be more strongly typed to accept List
locks
- locks to addpublic void addLock(Object lock)
Note that if a transaction is in scope, implementations should record this lock on the TransactionContext
.
Using this method should always ensure that the appropriate scope is used.
Note that currently (as of 3.0.0) this lock is weakly typed. This is to allow support for both MVCC (which uses Fqn
s as locks)
as well as legacy Optimistic and Pessimistic Locking schemes (which use NodeLock
as locks). Once support for
legacy node locking schemes are dropped, this method will be more strongly typed to accept Fqn
.
lock
- lock to addpublic void removeLock(Object lock)
Note that if a transaction is in scope, implementations should remove this lock from the TransactionContext
.
Using this method should always ensure that the lock is removed from the appropriate scope.
Note that currently (as of 3.0.0) this lock is weakly typed. This is to allow support for both MVCC (which uses Fqn
s as locks)
as well as legacy Optimistic and Pessimistic Locking schemes (which use NodeLock
as locks). Once support for
legacy node locking schemes are dropped, this method will be more strongly typed to accept Fqn
.
lock
- lock to removepublic void clearLocks()
Note that if a transaction is in scope, implementations should clear locks from the TransactionContext
.
Using this method should always ensure locks are cleared in the appropriate scope.
Note that currently (as of 3.0.0) this lock is weakly typed. This is to allow support for both MVCC (which uses Fqn
s as locks)
as well as legacy Optimistic and Pessimistic Locking schemes (which use NodeLock
as locks). Once support for
legacy node locking schemes are dropped, this method will be more strongly typed to accept Fqn
.
public boolean hasLock(Object lock)
TransactionContext
.
Using this method should always ensure locks checked in the appropriate scope.
lock
- lock to test
public boolean isLockingSuppressed()
PessimisticLockInterceptor
.public void setOriginLocal(boolean originLocal)
originLocal
- flag to setpublic boolean isLocalRollbackOnly()
public void reset()
public abstract InvocationContext copy()
TransactionContext
, if any, is maintained.
public void setState(InvocationContext template)
template
- template to copy from@Deprecated public MethodCall getMethodCall()
@Deprecated public void setMethodCall(MethodCall methodCall)
ReplicableCommand
instance passed in along with an InvocationContext.
methodCall
- methodcall to setpublic long getLockAcquisitionTimeout(long timeout)
timeout
- timeout to fall back to
@Deprecated public void setCommand(VisitableCommand cacheCommand)
cacheCommand
- command to set@Deprecated public VisitableCommand getCommand()
setCommand(org.jboss.cache.commands.VisitableCommand)
public boolean isValidTransaction()
public void throwIfNeeded(Throwable e) throws Throwable
e
- throwable to throw
Throwable
- if allowed to throw one.protected void doCopy(InvocationContext copy)
public void addFqnLoaded(Fqn fqn)
fqn
- fqn to addpublic Set<Fqn> getFqnsLoaded()
public void setFqnsLoaded(Set<Fqn> fqnsLoaded)
public String toString()
toString
in class Object
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |