How do you launch multiple threads from within Java EE?

后端 未结 6 1282
孤城傲影
孤城傲影 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:32

    What is the problem you are trying to solve with threads?

    If have long running tasks you should use JMS + a full Java EE container.

    If you trying to handle excess load you could consider two tomcat instances, however, if you are using http sessions you will need to investigate session replication.

    If you are forced to use Tomcat consider using the Executors framework in java.util.concurrency.

提交回复
热议问题