wood burning stoves*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Can we call System.exit(0) in service method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Can we call System.exit(0) in service method" Watch "Can we call System.exit(0) in service method" New topic
Author

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

Pandu Rangam
Greenhorn

Joined: Dec 08, 2006
Posts: 24
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?


SCJP 1.4,<br />SCWCD 1.4
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41066
    
  43
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.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can we call System.exit(0) in service method
 
Similar Threads
Closing an inner frame
destroy method
can we call destroy method in servlet service method?
arguments of System.exit()
destroy() method of servlets