Is it possible to get a callback from J/Link into java when the (remote) link closes or the Mathematica process is terminated (killed) altogether?
Unless you require to-the-millisecond notification of the link going down I'd recommend polling/heart-beating the connection from the java side, say once a second, with something like 1+1 as an input and checking for 2 in the response (or if you're truly paranoid generate two random integers in java on each call, add them in mathematica and check the answer java).
This is robust, it will tell you in a second if the link is broken for any reason. A message from the mathematica process when it shuts down will only get to you (your java process that is) if it shuts down cleanly but may not if the mathematica process has been killed or died abruptly for some reason...
- No one has pulled out the power.
- Tripped over the network cable.
- Poured coffee in the machine...
Polling gets round all of these.