File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 39537
    
  27
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 - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can we call System.exit(0) in service method
 
Similar Threads
destroy() method of servlets
Closing an inner frame
destroy method
can we call destroy method in servlet service method?
arguments of System.exit()