By default, servlets are multi-threaded.
If you specifically require a single-threaded servlet, you should implement the javax.servlet.SingleThreadModel interface.
This guarantees that no two threads will be operating on the same instance of the servlet, but still allows concurrent execution of the servlet.
The servlet engine will maintain a pool of available threads, and create new instances of the servlet as required.
This can cause performance problems however, and should be used sparingly except on low-traffic servers.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.