Communication between JVMTI agent and separate JVM

二次信任 提交于 2019-12-11 04:23:35

问题


First off i apologize as this is somewhat answered already here, but I think my situation is a bit different.

How to communicate with jvmti agent attached on a running JVM

My main question is... I am wondering if there are anyways using the JNI or other libraries to communicate between a JVMTI Native Agent and a completely separate JVM.

Here is a small illustration

So whats happening here. The JVM on the left is loaded with a native agent. Just for discussion sake let's assume I have no access to the source code of this java application. So instead I use the Java Native Agent to garner information from the objects.

Now I want to transfer the information to the JVM on the right. Represented by the broken link. Ideally i'd like to call a method on JVM2, have the Native Agent load information from JVM1 and then return it to JVM2.

I'm pretty sure I can do this with sockets, but I was just wondering if I had any other options here such as using JNI and registering native agents or something like mentioned in the previous answer.


回答1:


So since nobody replied, I'll just post here that I'm gonna use Sockets.

Here is an example I used.

sending doubles via TCP between Boost ASIO server and Java client



来源:https://stackoverflow.com/questions/43555268/communication-between-jvmti-agent-and-separate-jvm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!