-
Dec 18th, 2008, 03:12 AM
#1
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
#2
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.
Jonas Partner
OpenCredo
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules