Starting a threadpool in a servlet container

后端 未结 5 840
野性不改
野性不改 2021-01-14 14:27

I have a servlet S which handles callbacks from a 3rd party site.

The callback invocations happen in a specific order. Thus, I need to queue them.

I propos

5条回答
  •  花落未央
    2021-01-14 14:38

    I second the comment that says managing your own thread pool is a bad idea.

    Servlets are for handling HTTP requests. HTTP is a synchronous request/response protocol. The logic for how they're handled belongs somewhere else. That handler may be synchronous or asynchronous, but that should be up to the handler implementation. The servlet should decide which handler to defer to for a given response and that's it.

    Even if you use Tomcat or a servlet/JSP engine, you can still use Spring, JMS, and MDPs by adding ActiveMQ to your Tomcat implementation.

提交回复
热议问题