码迷,mamicode.com
首页 > 其他好文 > 详细

Thread -- Request

时间:2017-02-09 00:38:51      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:color   span   容器   ted   nbsp   net   can   cal   ref   

Servlet容器应该绝大部分(有可能全部)是Thread per Request,每个请求一个线程。此外有Thread per Connection,应该不是用于Servlet容器。请见

How are Threads allocated to handle Servlet request?

另外,大部分容器使用线程池管理线程。

 

上面链接中也提到在Java EE环境下不要创建太多自己的线程,要向容器申请线程,参见评论中的链接:

Why is spawning threads in Java EE container discouraged?

 

如果在线程中使用threadlocal,也许需要考虑清理threadlocal,请见:

How to clean up threadlocals

ThreadLocal Variables and Thread Pools – It Can Go Wrong

Thread -- Request

标签:color   span   容器   ted   nbsp   net   can   cal   ref   

原文地址:http://www.cnblogs.com/drizzlewithwind/p/6378220.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!