2016/05/28 - Apache Tuscany has been retired.

For more information, please explore the Attic.



org.apache.tuscany.sca.core.invocation
Class ThreadMessageContext

java.lang.Object
  extended by org.apache.tuscany.sca.core.invocation.ThreadMessageContext

public final class ThreadMessageContext
extends java.lang.Object

Class for tunnelling a WorkContext through the invocation of a user class.


Method Summary
static Message getMessageContext()
          Returns the WorkContext for the current thread.
static Message setMessageContext(Message context)
          Set the WorkContext for the current thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setMessageContext

public static Message setMessageContext(Message context)
Set the WorkContext for the current thread. The current work context is returned and must be restored after the invocation is complete. Typical usage would be:
   WorkContext old = PojoWorkContextTunnel.setThreadWorkContext(newContext);
   try {
      ... invoke user code ...
   } finally {
     PojoWorkContextTunnel.setThreadWorkContext(old);
   }
 

Parameters:
context -
Returns:
the current work context for the thread; this must be restored after the invocation is made

getMessageContext

public static Message getMessageContext()
Returns the WorkContext for the current thread.

Returns:
the WorkContext for the current thread