org.infinispan.context
Class InvocationContextContainerImpl

java.lang.Object
  extended by org.infinispan.context.InvocationContextContainerImpl
All Implemented Interfaces:
InvocationContextContainer

public class InvocationContextContainerImpl
extends Object
implements InvocationContextContainer

Default implementation for InvocationContextContainer.

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

Constructor Summary
InvocationContextContainerImpl()
           
 
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 init(TransactionManager tm, TransactionTable transactionTable)
           
 void resume(InvocationContext ctxt)
          Associates the supplied InvocationContext with the calling thread.
 InvocationContext suspend()
          Disassociates thread's invocation context and returns the existing value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InvocationContextContainerImpl

public InvocationContextContainerImpl()
Method Detail

init

public void init(TransactionManager tm,
                 TransactionTable transactionTable)

createInvocationContext

public InvocationContext createInvocationContext()
Description copied from interface: InvocationContextContainer
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 InvocationContextContainer.getInvocationContext() will return same instance.

Specified by:
createInvocationContext in interface InvocationContextContainer

createTxInvocationContext

public LocalTxInvocationContext createTxInvocationContext()
Description copied from interface: InvocationContextContainer
Returns a LocalTxInvocationContext. The context is also associated with the current thread, so further calls to InvocationContextContainer.getInvocationContext() will return same instance.

Specified by:
createTxInvocationContext in interface InvocationContextContainer

createRemoteTxInvocationContext

public RemoteTxInvocationContext createRemoteTxInvocationContext()
Description copied from interface: InvocationContextContainer
Returns an RemoteTxInvocationContext. The context is also associated with the current thread, so further calls to InvocationContextContainer.getInvocationContext() will return same instance.

Specified by:
createRemoteTxInvocationContext in interface InvocationContextContainer

createNonTxInvocationContext

public NonTxInvocationContext createNonTxInvocationContext()
Description copied from interface: InvocationContextContainer
Will create an NonTxInvocationContext with the NonTxInvocationContext.isOriginLocal() returning true.

Specified by:
createNonTxInvocationContext in interface InvocationContextContainer

createRemoteInvocationContext

public NonTxInvocationContext createRemoteInvocationContext()
Description copied from interface: InvocationContextContainer
Returns an NonTxInvocationContext whose NonTxInvocationContext.isOriginLocal() flag will be true. The context is also associated with the current thread, so further calls to InvocationContextContainer.getInvocationContext() will return same instance.

Specified by:
createRemoteInvocationContext in interface InvocationContextContainer

getInvocationContext

public InvocationContext getInvocationContext()
Description copied from interface: InvocationContextContainer
Returns the InvocationContext that is currently associated with the calling thread. Important: implementations of this method is most likely expensive (ThreadLocal.get), it is recommended to cache the result of this method rather than repeating the call.

Specified by:
getInvocationContext in interface InvocationContextContainer

suspend

public InvocationContext suspend()
Description copied from interface: InvocationContextContainer
Disassociates thread's invocation context and returns the existing value.

Specified by:
suspend in interface InvocationContextContainer

resume

public void resume(InvocationContext ctxt)
Description copied from interface: InvocationContextContainer
Associates the supplied InvocationContext with the calling thread.

Specified by:
resume in interface InvocationContextContainer

Google Analytics

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