Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

who calls service method ?

 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i have got bunch of questions about servlet and life cycle.

Who calls service method & which class implements the service method ?


and if i deploy one web application today and tomorrow i undeploy it. in 1 day if i get 100 request.

how many times init() will be called ?
how many times service() method will be called ?
and how many times destroy() will be called ?

Thanks & Regards,
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A good place to start would be the servlet spec.
The section on the servlet life cycle is clear and well written.
You can find a link to this document in my signature.

Anyway.
The container calls the service method whenever a request comes in.
Init and destry will most likely be called once. (containers are free to take servlets out of commission to save resources). Each time it is taken out of service, the destroy method is called. Each time it it put into service, the init method will be called.
[ March 26, 2008: Message edited by: Ben Souther ]
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i was posting the question i was knowing your answer.. "Servlet Spec"

Thanks... Will refer the servlet spec for "who calls service method "
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ben Souther:
The container calls the service method whenever a request comes in.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic