How to set a Thread-local in the thread provided by tomcat?

问题: So, Tomcat has its own thread-pool and for each request, it gets a thread (Thread A)from this pool and uses and clears the same after completion. Is there a way to initia...

问题:

So, Tomcat has its own thread-pool and for each request, it gets a thread (Thread A)from this pool and uses and clears the same after completion.

Is there a way to initialise a thread-local variable when this thread (Thread A) gets initialised?

Purpose here is to calculate the processing time, where I need to set a time on thread creation and will be using this time to calculate the before processing time before sending out to the client.


回答1:

The processing time corresponds to the time-taken field of the Extended Access Log Valve. Maybe you don't need to reinvent the wheel in this case.

  • 发表于 2018-12-28 03:19
  • 阅读 ( 201 )
  • 分类:网络文章

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除