This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock exam question

 
Shashidhar Yarabati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem:
Assuming that the Servlet Container has just called the destroy() method of a servlet instance, which of the following statements are correct?

Options:
1. Any resources that this servlet might hold have been released.
2. The servlet container time out has exceeded for this servlet instance.
3. The init() method has been called on this instance.
4. None of the requests can EVER be serviced by this instance.
5. All threads created by this servlet are done.

Answers Given: 3 & 4

How come the 3rd Option is right? will it call init() again?
(He didn't sayed anything like the new request come again in the question)
 
Prem Kashyap
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The init() method has been called on this instance. And we all know init() method is always called once when the servlet is loaded.

So it is saying, it not called when destroy is called , but it has been called previously..

Regards

Prem Kashyap
 
Shashidhar Yarabati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for helping me to understand.

But it sound's like it just called again...
 
Gurukant Desai
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
option 5 also seems correct "5. All threads created by this servlet are done."
Because unless all the threads are serviced destroy() cannot be called. Right?
Can someone please throw light on this concept?
 
Pavan Sambare
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Option 5 also seems correct. Till all the threads spawned by this Servlet instance are not done, the destroy() should not be called as destroy is called only when removing the instance from memory.

Can someone please confirm?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic