Reputation: 3566
In node.js
world, there are apps like Supervisor
- it's a daemon process that checks if your app is running, and if not (closed, crashed), it restarts it instantly. That's very nice way of temporary handling critical errors in production, when one feature could fail, but rest of system is still running.
I come from PHP
background where all you had to do is to press back
button in browser, when something is broken.
How to achieve this behavior in Spring Boot
? So far what I noticed is that when app faces unhandled exception, it crashes and whole server is down. I know that those kind of errors are the ones that one should fix asap, but sometimes it's just impossible, and system needs to be running.
Are there any tools that work like Node.js
supervisor
?
Upvotes: 2
Views: 2971
Reputation: 2555
In the past I sometimes used the Java Wrapper by Tanuki which worked quite nice. Otherwise you do have the option to either monitor the process and automatically restart if it fails (dependent on your system environment) or on the highest level of you application catch Throwable, which will not be a good idea because you'll catch fatal cases that by intend should kill your jvm execution, e.g. OutOfMemory...
Upvotes: 1