• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

clarification needed regarding destroy()'s behaviour

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 15
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
UP

Someone?!
Tks
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic