wood burning stoves*
The moose likes Servlets and the fly likes servlet init() called more than once Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet init() called more than once" Watch "servlet init() called more than once" New topic
Author

servlet init() called more than once

ravisha andar
Ranch Hand

Joined: Feb 25, 2011
Posts: 55
Hi All,

As per my reading the servlets init() method is called only once.

Is there any scenario in which it is called more than once ?

What happens whe we implement the singlethread model?

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

No. Not for the same servlet instance.

You should never implement the single thread model.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
ravisha andar
Ranch Hand

Joined: Feb 25, 2011
Posts: 55
Thanks.

i will not implement.

I was asking for my knowledge. Since if we imement single threadmodel we get a new instance for each request, will the init() and destroy be called for each instance
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

Yes.
 
wood burning stoves
 
subject: servlet init() called more than once