When and how should I use a ThreadLocal variable?

前端 未结 25 2267
再見小時候
再見小時候 2020-11-22 12:35

When should I use a ThreadLocal variable?

How is it used?

25条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 13:20

    Webapp server may keep a thread pool, and a ThreadLocal var should be removed before response to the client, thus current thread may be reused by next request.

提交回复
热议问题