• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDiscuss.com Question

 
Raj Paul
Ranch Hand
Posts: 77
  • 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

Select 2 correct options.

Any resources that this servlet might hold have been released.

The servlet container time out has exceeded for this servlet instance.

The init() method has been called on this instance.

None of the requests can EVER be serviced by this instance.

All threads created by this servlet are done.



I feel third & fourth are correct , Please let me know the answers.
Thanks & Regards
Mike
 
Tauqueer Ali
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike
I think you are right. here's a breif explanation
1. Any resources that this servlet might hold have been released.
* False. Only if the destroy function has been
implemented to do so by servlet developer.
2. The servlet container time out has exceeded for this servlet instance.
* False. When servlet container time out has
exceeded HttpSession is destroyed. destroy
function can be called anytime as the servlet
container may be stopped anytime.
3. The init() method has been called on this instance.
* True. destroy can only be called when servlet
instance has been created, which mean init must
have been called.
4. None of the requests can EVER be serviced by this instance.
* True. After destroy function has been called
on an instance, it can not serve any request.
5. All threads created by this servlet are done.
* False. the servlet container may be shutdown
anytime, even when service threads are
executing.
 
Raj Paul
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I knew this answer...but i couldn't digest the answer (particular answer) i.e. The destroy method will be called if init() has been called.
When the container..creates more than instance if the servlet doesn't implement SingleThreadModel
Any clarification ?
Thanks & Regards
Mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic