The demo shows how to attach to running JVM process by using Dynamic Attach API and Golang.
tl;dr:
- check user permissions
- create "attach file"
- send SIGQUIT to the target JVM
- send the command to the socket
I suggest going trough dunamic_attach.go#executeCommand method to see what's inside.
Just run docker-compose up
and observe the output carefully.
See also blogpost describing what one could do using techniques presented here.