Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

does init method exexcutes everytime

 
Chandra Bairi
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does init() method exexutes everytime for each and every servlet instance created in a singleThreadModel implemented servlet or only the service method gets executed for separate threads for separate instances.
 
Mikalai Zaikin
Ranch Hand
Posts: 3381
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
The "init" method executed *once* for *every* servlet instance.
It does not matter implements it oe not SingleThreadedModel (STM).
But in case of STM, container might decide to have several instances
of the same servlet to improve performance , and "init" method will be invoked for *every* instance of the same servlet, but only *once*.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!