• 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

Can we call System.exit(0) in service method

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
First of all thanks for your prompt replies on my previous posts.
My questions are
1) can we call System.exit(0) in servlet's life cycle methods (eg service)?
2) Can we call destroy explicitly from service method?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

1) can we call System.exit(0) in servlet's life cycle methods (eg service)?


What would be the point of that? You'd be trying to force the JVM to quit, and thus the servlet container to stop. That's why servers in a production settings run with a security manager enabled, which prohibits calls to System.exit (amongst other things).

2) Can we call destroy explicitly from service method?[/QB]


init and destroy are servlet lifecycle methods, which are called by the servlet container. You can call them, but you absolutely should not.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic