/** * 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: * <pre> * WorkContext old = PojoWorkContextTunnel.setThreadWorkContext(newContext); * try { * ... invoke user code ... * } finally { * PojoWorkContextTunnel.setThreadWorkContext(old); * } * </pre> * @param context * @return the current work context for the thread; this must be restored after the invocation is made */ public static Message setMessageContext(Message context) { Message old = CONTEXT.get(); CONTEXT.set(context); PREVIOUS_CONTEXT.set(old); // TUSCANY-3770: Remove thread context information when the request invocation has completed if (context == msg) { removeMessageContext(); removePreviousMessageContext(); } return old; }
/** * 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: * <pre> * WorkContext old = PojoWorkContextTunnel.setThreadWorkContext(newContext); * try { * ... invoke user code ... * } finally { * PojoWorkContextTunnel.setThreadWorkContext(old); * } * </pre> * @param context * @return the current work context for the thread; this must be restored after the invocation is made */ public static Message setMessageContext(Message context) { Message old = CONTEXT.get(); CONTEXT.set(context); PREVIOUS_CONTEXT.set(old); // TUSCANY-3770: Remove thread context information when the request invocation has completed if (context == msg) { removeMessageContext(); removePreviousMessageContext(); } return old; }
ThreadMessageContext.removeMessageContext();
ThreadMessageContext.removeMessageContext();