We are developing the web application using java. I want to use System.exit()
in one of my methods instead of return. As per my knowledge, the application will go into shut down mode if I use this.
Could anybody give me suggestions on this?
We are developing the web application using java. I want to use System.exit()
in one of my methods instead of return. As per my knowledge, the application will go into shut down mode if I use this.
Could anybody give me suggestions on this?
In general, this is a pretty terrible idea, but the rule of thumb is System.exit()
shuts down the entire JVM.
Your web application should be able to handle responses rather than just kill itself, I don't know of a good scenario where you'd ever want it to kill itself.
System.exit()
will shutdown the Servlet Container / (Tomcat)
Similar question noted at When should we call System.exit in Java