• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Servlet Destroy

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What will happen if I call destroy() method as a last statement of doGet() method.
Will it destroy the servlet??
Also when a servlet is being destroyed is the destroy() method first called or is finalize() called??
If anyone knows the answers for the above please let me know.
 
Ranch Hand
Posts: 395
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
when you explicitly call the destroy method, the container executes it and makes the servlet instance to be Garbage collected.
regarding the finalize method, it is called when the servlet is about to be garbage collection. Agian the GC is not sure to be called everytime.When the resources are low GC thread will be called by the JVM.
So the Destroy method doesn't have any realtion with the Finalize method.
Usually Destroy methos is used to release some resources like, Database connections, network connections, files and so on.
Cheers.
reply
    Bookmark Topic Watch Topic
  • New Topic