Announcement Announcement Module
No announcement yet.
how to deal with threadlocal Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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?

  • #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.