Does each request access the same servlet object?

前端 未结 2 2003
渐次进展
渐次进展 2020-12-30 01:04

Does each HTTP request access the same servlet object but in a different thread? or does it create a new thread and new Servlet Instance ?

2条回答
  •  遥遥无期
    2020-12-30 02:10

    Each HTTP request creates a new thread but accesses the same instance of the Servlet.

    EDIT: In case of one server node, you will have the same Servlet instance on that node. In case of load balancing/many servers you will usually have one instance per Java VM.

提交回复
热议问题