Java Servlets threading model

前端 未结 3 1228
孤城傲影
孤城傲影 2021-02-13 03:49

I was wondering if anybody could explains me the threading model of Java Servlets? As I understood about that, there is only one instance of a servlet can be existed in the serv

3条回答
  •  忘掉有多难
    2021-02-13 04:03

    If requests were handled serially by servlets, then web applications would be very slow. It's actually the case that servlets need to be thread-safe, because a single instance of a servlet can be responsible for handling multiple requests simultaneously.

    Usually a web application container will maintain a thread pool for handling requests, with incoming requests being assigned to threads on an on-demand basis.

提交回复
热议问题