I would like to understand a strategy, if any, about how to react on Out Of Memory heap errors / OOM errors in Java.
To my current understanding, these errors "break" the program so the code itself might stop (or substantaily slow down) performing.
However for example Hazelcast seem to have some technology that deals with such situations.
Yet, I would like to add in my code a fail-over routine that for instance shots program down gracefully and/or trigger external scripts that take care of memdumps, alerts and the like.