Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we use System.exit() in java Web Applications [closed]

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?

like image 974
User Avatar asked Dec 24 '22 23:12

User


1 Answers

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.

like image 62
david99world Avatar answered Dec 27 '22 13:12

david99world