首页 > 其他 > 详细

Thread -- Request

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

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!