Dec 18th, 2008, 03:12 AM
how to deal with threadlocal
Consider such a scene, it wants set some variable into ThreadLocal in client, and then retrieve the variable from ThreadLocal in server. But when using SI http or rmi transport, some problem occurs. For the use of poller and channel, the thread in server is not the same as that of sender in client. Then the server could not get the corrent variable values stored in ThreadLocal. Could you give me some advice to solve this problem?
Dec 18th, 2008, 04:01 AM
My general advice would be to avoid using thread local in SI since it is designed to allow for asynchronous execution so you should not make assumptions about which thread will be used to invoke your code. This will make your life much easier. Generally if you want to propagate context with the message use the message headers.