Results 1 to 2 of 2

Thread: how to deal with threadlocal

  1. #1
    Join Date
    Oct 2008
    Posts
    18

    Default 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. #2
    Join Date
    Oct 2007
    Location
    London, England
    Posts
    108

    Default

    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
  •