How do you launch multiple threads from within Java EE?

后端 未结 6 1216
孤城傲影
孤城傲影 2021-01-01 04:02

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?

6条回答
  •  被撕碎了的回忆
    2021-01-01 04:13

    Your question is a bit vague. Tomcat itself already uses a thread pool to service HTTP requests. You can increase the number of threads through Tomcat configuration - look to the Tomcat wiki for info on this.

    If you mean that in your code you want to launch threads, then I advise perusing the java.util.concurrent API introduced in Java 5. Also read "Java Concurrency in Practice", which is the text on this subject.

提交回复
热议问题