• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

clarification needed regarding destroy()'s behaviour

 
Saurabh Kumar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Here is a question:
25.Assuming that the Servlet Container has just called the destroy()
method of a servlet instance, which of the following statements are
correct?

Select 2 correct options.
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.
E.All threads created by this servlet are done.
ANS : C,D

My query is: the option E means all the thread that the servlets might have created; not the threads which might have been created by client's request?
And any thread can run independent of parent thread(initiated by user's request) even if the parent thread finishes and destroy() is called.

Please confirm.

Thanks and regards,
Saurabh
 
Luciano Leite
Greenhorn
Posts: 15
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UP

Someone?!
Tks
 
Rancy Chadha
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Saurabh,


My query is: the option E means all the thread that the servlets might have created; not the threads which might have been created by client's request?
And any thread can run independent of parent thread(initiated by user's request) even if the parent thread finishes and destroy() is called.


With respect to threading, Container will call destroy()only after all the threads created by the servlet instance and all the threads created by each service() are completed. It will not so happen that destroy() is called after parent thread is completed and the child threads keep running. Please refer to SRV 2.3.4 End of Service topic in Servlet specs ver 2.4. There is quote in this section given as:


Before the servlet container calls the destroy method, it must allow any threads that are currently running in the service method of the servlet to complete, execution, or exceed a server-defined time limit.


I hope I have answered your doubt. In case I am wrong please let me know.

Thanks
-Rancy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic