• 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

Servlet

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can we invoke destroy method of a servlet in it's service method?
if yes,what would be the effect and if no why?
 
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can we invoke destroy method of a servlet in it's service method?

Yes. It is like any other method. So, you can call it from the service method.

if yes,what would be the effect?

Nothing special. The statements in the destroy method gets executed, as it would happen in any other method.

The only thing special with the destroy method is that, this method is called by the Servlet Container when the servlet is unloaded.
[ July 08, 2005: Message edited by: Mani Ram ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mani Ram:
[qb]can we invoke destroy method of a servlet in it's service method?

Yes. It is like any other method. So, you can call it from the service method.

if yes,what would be the effect?

Nothing special. The statements in the destroy method gets executed, as it would happen in any other method.

The only thing special with the destroy method is that, this method is called by the Servlet Container when the servlet is unloaded.

[ July 08, 2005: Message edited by: Mani Ram ][/QB]




Further, there is no reason to ever call the destroy method yourself.
 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Prashant Kirtiwar:
can we invoke destroy method of a servlet in it's service method?
if yes,what would be the effect and if no why?



Did you try calling it? What happened?
 
reply
    Bookmark Topic Watch Topic
  • New Topic