• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet instances

 
ravi chappa
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can we specify that while application is loading,how many instances of servlet container should create?
 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

There's always only one instance of a servlet (unless you implement SingleThreadModel, which is not very scalable). The threads spawned by the container call this instance's service method.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That also means the servlet code needs to be thread-safe, or you may run into trouble during concurrent accesses.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!