I need to scale calls into Tomcat and it's been suggested to launch threads internally. Has anyone needed to do this and, if so, what solutions did they come up with?
解决方案
Creating your own threads inside an application server is generally discouraged because the server should manage threads for better scalability. You can also run into problems if the container makes assumptions about what's available in a thread context, such as security information (e.g., authenticated Subject). That typically happens if you spawn a thread and then use a server resource from that thread which is unknown to the container.
Check to see if there is a way to get container managed threads from Tomcat. WebLogic and WebSphere support the commonj.WorkManager, which allows you to schedule work on container managed threads. Spring can also use commonj, but I'm not sure if that support is available on Tomcat.
在考虑在Tomcat中扩展调用时,通常不建议在应用程序服务器内部创建线程,因为服务器应该负责线程管理以提高可扩展性。这样做可能会导致与容器对线程上下文的假设冲突,比如安全性信息(如认证主题)。你应该检查是否有从Tomcat获取容器管理线程的方法。WebLogic和WebSphere支持commonj.WorkManager,允许在容器管理的线程上调度工作,Spring也支持commonj,但不确定是否适用于Tomcat。
2470

被折叠的 条评论
为什么被折叠?



