org.infinispan.context
Interface InvocationContextContainer

All Known Implementing Classes:
AbstractInvocationContextContainer, NonTransactionalInvocationContextContainer, TransactionalInvocationContextContainer

public interface InvocationContextContainer

Manages the association between an InvocationContext and the calling thread. Also acts as a factory for creating various types of InvocationContexts.

Since:
4.0
Author:
Manik Surtani (manik AT infinispan DOT org), Mircea.Markus@jboss.com

Field Summary
static int UNBOUNDED
          To be used when building InvocationContext with createInvocationContext(boolean, int) as an indicator of the fact that the size of the keys to be accessed in the context is not known.
 
Method Summary
 void clearThreadLocal()
          Must be called as each thread exists the interceptor chain.
 InvocationContext createInvocationContext(boolean isWrite, int keyCount)
          If we are in a tx scope this will return an TxInvocationContext.
 InvocationContext createInvocationContext(Transaction tx)
          Creates an invocation context
 NonTxInvocationContext createNonTxInvocationContext()
          Will create an NonTxInvocationContext with the NonTxInvocationContext.isOriginLocal() returning true.
 InvocationContext createRemoteInvocationContext(Address origin)
          Returns an NonTxInvocationContext whose NonTxInvocationContext.isOriginLocal() flag will be true.
 InvocationContext createRemoteInvocationContextForCommand(VisitableCommand cacheCommand, Address origin)
          As createRemoteInvocationContext(org.infinispan.remoting.transport.Address), but returning the flags to the context from the Command if any Flag was set.
 RemoteTxInvocationContext createRemoteTxInvocationContext(RemoteTransaction tx, Address origin)
          Returns an RemoteTxInvocationContext.
 InvocationContext createSingleKeyNonTxInvocationContext()
          Will create an NonTxInvocationContext with the NonTxInvocationContext.isOriginLocal() returning true.
 LocalTxInvocationContext createTxInvocationContext()
          Returns a LocalTxInvocationContext.
 InvocationContext getInvocationContext(boolean quiet)
          Deprecated. see implementation for notes
 

Field Detail

UNBOUNDED

static final int UNBOUNDED
To be used when building InvocationContext with createInvocationContext(boolean, int) as an indicator of the fact that the size of the keys to be accessed in the context is not known.

See Also:
Constant Field Values
Method Detail

getInvocationContext

@Deprecated
InvocationContext getInvocationContext(boolean quiet)
Deprecated. see implementation for notes

Returns the InvocationContext that is currently associated with the calling thread. Important: implementations of this method are most likely expensive, involving thread locals. It is recommended to cache the result of this method rather than repeating the call.

Parameters:
quiet -
Throws:
IllegalStateException - if there is no context associated with the current thread.

createInvocationContext

InvocationContext createInvocationContext(boolean isWrite,
                                          int keyCount)
If we are in a tx scope this will return an TxInvocationContext. Otherwise it will return an NonTxInvocationContext. Either way, both context will be marked as local, i.e. InvocationContext.isOriginLocal() will be true.


createInvocationContext

InvocationContext createInvocationContext(Transaction tx)
Creates an invocation context

Parameters:
tx -
Returns:

createNonTxInvocationContext

NonTxInvocationContext createNonTxInvocationContext()
Will create an NonTxInvocationContext with the NonTxInvocationContext.isOriginLocal() returning true.


createSingleKeyNonTxInvocationContext

InvocationContext createSingleKeyNonTxInvocationContext()
Will create an NonTxInvocationContext with the NonTxInvocationContext.isOriginLocal() returning true.


createTxInvocationContext

LocalTxInvocationContext createTxInvocationContext()
Returns a LocalTxInvocationContext.


createRemoteTxInvocationContext

RemoteTxInvocationContext createRemoteTxInvocationContext(RemoteTransaction tx,
                                                          Address origin)
Returns an RemoteTxInvocationContext.

Parameters:
tx - remote transaction
origin - the origin of the command, or null if local

createRemoteInvocationContext

InvocationContext createRemoteInvocationContext(Address origin)
Returns an NonTxInvocationContext whose NonTxInvocationContext.isOriginLocal() flag will be true.

Parameters:
origin - the origin of the command, or null if local

createRemoteInvocationContextForCommand

InvocationContext createRemoteInvocationContextForCommand(VisitableCommand cacheCommand,
                                                          Address origin)
As createRemoteInvocationContext(org.infinispan.remoting.transport.Address), but returning the flags to the context from the Command if any Flag was set.

Parameters:
cacheCommand -
origin - the origin of the command, or null if local

clearThreadLocal

void clearThreadLocal()
Must be called as each thread exists the interceptor chain.


-->

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