• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

destroy() method doubt

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

a)Any resources that this servlet might hold have been released.
b) The servlet container time out has exceeded for this servlet instance.
c) The init() method has been called on this instance.
d) None of the requests can EVER be serviced by this instance.
(Once destroyed(), this instance is out of the scene! It can't be reused. A new instance will be created if needed.)

e) All threads created by this servlet are done.
(The servlet container cannot kill them and has no idea whether they are done or not.)
Ans : c and d

Is option e) incorrect. Will servlet container call destroy() even when all threads on that servlet instance are not done yet.

(The servlet container cannot kill them and has no idea whether they are done or not.)

Servlet Container creates these threads, hence it must have idea when they are done....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic