• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

destroy() method

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a doubt in the anwer of below mentioned question which i picked from jdiscuss.com.
As for jdiscss,the answer is 3 and 4. But I'm not sure,please anybody know the better discription,let me know.
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.

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.
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Any resources that this servlet might hold have been released.


False: destroy() gives the servlet an opportunity to clean up any resources that are being held.

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


Partly true. Another reason is that all threads within the servlet's service method have exited.

The init() method has been called on this instance


True: If init didn't work, then there would not be a servlet in service to start with.

None of the requests can EVER be serviced by this instance


True, the servlet container will not call the service method again on this servlet.

All threads created by this servlet are done


Partly true. Another reason is that a timeout period has passed. This may have been set in the deployment descriptor like this (for 30 minutes):
<session-config>
<session-timeout>30</session-timeout>
</session-config>
Also, the HttpSession interface has a method to set a session invalidated period (in seconds):
setMaxInactiveInterval(3600)
[ September 24, 2003: Message edited by: Roger Chung-Wee ]
 
There are no more "hours", it's centi-days. They say it's better, but this tiny ad says it's stupid:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic