如何向 JNI_CreateJavavm 调用创建的 JVM 发送信号?
我是否可以直接向通过在本机 C/C++ 代码中调用 JVM_CreateJavavm 创建的 Java 虚拟机发送信号?
例如:
对于一个普通的Java进程,假设它的pid是12345,我可以像这样向它发送信号3...... kill -3 12345,希望我可以通过更改 JVM 配置来触发 javacore 或 heapdump。
但是,如果 JVM 是通过 JNI API 创建并包装在 C/C++ 应用程序中,则只有本机进程的 PID 可见,在这种情况下,如果我向该进程发送信号,整个进程就会终止,并且 JVM 似乎无法接收到根本没有信号。
提前致谢 ...
Is there any possibility that I can directly send signal to a Java virtual machine which is created by calling JVM_CreateJavavm
in native C/C++ code?
e.g.:
For a normal Java process, say its pid is 12345, I can send a signal 3 to it like this ...
kill -3 12345, and hopefully I could trigger javacore or heapdump by changing JVM configurations.
However if the JVM is created thru JNI API and wrapped inside a C/C++ application, only the native process's PID is visible, in that case if I send signal to that process, the whole process is just terminated and seems the JVM cannot receive the signal at all.
Thanks in advance ...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不。JVM 没有单独的进程。 JVM 只是在调用它的进程中运行。我不认为 Sun 记录了通过调用接口使用这些信号处理程序的方法。
No. There is no separate process for the JVM. The JVM is just running in the process that called it. I don't think that Sun documents a way to use those signal handlers via the invocation interface.
http://www.scribd.com/doc/13119378/If-JNI-based-application-is-crashing-check-signal-handling" scribd.com/doc/13119378/If-JNI-based-application-is-crashing-check-signal-handling
http://www.scribd.com/doc/13119378/If-JNI-based-application-is-crashing-check-signal-handling