• Post Reply Bookmark Topic Watch Topic
  • New Topic

How can we create instances

 
Ranga Reddy shreya
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If more users are accessing a servlet do we need to create instances more. If not what is the procedure for that.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the container handles any such decisions. And in modern containers, only a single instance, which must be written to be thread-safe, is used.
 
nandkishor rao
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah the container creates threads of your single servlet instance.
You don't have to worry about that.But for the sake of your information,
you can create another instance of your servlet by adding the servlet-name and servlet-class one more time in web.xml
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!