org.infinispan.context
Interface InvocationContextContainer

All Known Implementing Classes:
InvocationContextContainerImpl

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@jboss.org), Mircea.Markus@jboss.com

Method Summary
 InvocationContext createInvocationContext()
          If we are in a tx scope this will return an TxInvocationContext.
 NonTxInvocationContext createNonTxInvocationContext()
          Will create an NonTxInvocationContext with the NonTxInvocationContext.isOriginLocal() returning true.
 NonTxInvocationContext createRemoteInvocationContext()
          Returns an NonTxInvocationContext whose NonTxInvocationContext.isOriginLocal() flag will be true.
 RemoteTxInvocationContext createRemoteTxInvocationContext()
          Returns an RemoteTxInvocationContext.
 LocalTxInvocationContext createTxInvocationContext()
          Returns a LocalTxInvocationContext.
 InvocationContext getInvocationContext()
          Returns the InvocationContext that is currently associated with the calling thread.
 void resume(InvocationContext ic)
          Associates the supplied InvocationContext with the calling thread.
 InvocationContext suspend()
          Dissasociates thread's invocation context and returns the existing value.
 

Method Detail

createInvocationContext

InvocationContext createInvocationContext()
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. The context is also associated with the current thread, so further calls to getInvocationContext() will return same instace.


createNonTxInvocationContext

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


createTxInvocationContext

LocalTxInvocationContext createTxInvocationContext()
Returns a LocalTxInvocationContext. The context is also associated with the current thread, so further calls to getInvocationContext() will return same instace.


createRemoteTxInvocationContext

RemoteTxInvocationContext createRemoteTxInvocationContext()
Returns an RemoteTxInvocationContext. The context is also associated with the current thread, so further calls to getInvocationContext() will return same instace.


createRemoteInvocationContext

NonTxInvocationContext createRemoteInvocationContext()
Returns an NonTxInvocationContext whose NonTxInvocationContext.isOriginLocal() flag will be true. The context is also associated with the current thread, so further calls to getInvocationContext() will return same instace.


getInvocationContext

InvocationContext getInvocationContext()
Returns the InvocationContext that is currently associated with the calling thread. Important: implementations of this metrhod is most likely expensive (ThreadLocal.get), it is recommanded to cache the result of this method rather than repeting the call.

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

suspend

InvocationContext suspend()
Dissasociates thread's invocation context and returns the existing value.


resume

void resume(InvocationContext ic)
Associates the supplied InvocationContext with the calling thread.


Google Analytics

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