Java Agent
Java Agent机制
两个线程
- Signal Dispatcher(随jvm启动而启动,处理信号)
- Attach Listener, 这个线程通过Unix Domain Socket跟外部进程通讯(.java_pid
)
On Linux and Solaris, the client creates a file named .attach_pid
and sends a SIGQUIT to the target JVM process. The existence of this file causes the SIGQUIT handler in HotSpot to start the attach listener thread.
- 注意 kill -3 并不会杀死java进程。默认行为是产生thread dump。除非JVM中重新定义了SIGQUIT(-3)的处理handler。产生JVM thread dump
1 | kill -3 pid |
两个文件
- .attach_pid
(启动attach listener线程用) - .java_pid
(Unix socket domain)
参考
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 石头记!