79825619

Date: 2025-11-20 14:31:39
Score: 0.5
Natty:
Report link

You cannot control the JVM process from your Java application running inside the JVM.
JDWP Debug Agent is a tool provided by the JVM and runs at a lower level than your application.

Shutdown hooks run before the JVM tears down subsystems, and the debug agent is destroyed after the shutdown hook

I would advise against using the shutdown hooks to provide resilience, as it can lead to restart loops.

Instead, you can offload the recovery to an external supervisor. In this example, a cron job is used. Or you can run the Java application from a parent process (eg, bash script) that will restart it if it crashes.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Spyros Palaiokostas