• Post Reply Bookmark Topic Watch Topic
  • New Topic

statement about init() method

 
Iftikhar Arain
Ranch Hand
Posts: 95
Flex Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
init() is called only once per instance. And it is called when the servlet container loads the servlet. In cases of high load, it may also instantiate multiple instances of a servlet. In this case, init() will be called on each of the instances.
I think according to the API if servlet does not implement SingleThreadModel then only one instance is created and mutiple threads share this instance.
 
Dominic Steng�rd
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
The init(ServletConfig) method will only be called once. The only two exceptions are if you have declared that this class will implement the SingleThreadModel interface or if more than one <servlet> element is defined in the web.xml file having the same servlet class names.
Regards
[ October 19, 2002: Message edited by: Dominic Steng�rd ]
 
Iftikhar Arain
Ranch Hand
Posts: 95
Flex Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dominic .
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!