We are developing an application for obtaining the information of a running java application using JDWP and JVMTI. Sun Java comes with a reference implementation of JDWP so using agentlib -jdwp: will use the reference implementation. Our aim is to study JVMTI and write JVMTI agents to get specific detail. Also creating a Front end using which the user can request for specific information about the running java application. For this we would have to write our implementation for JDWP. Though we were able to write JVMTI agents and use it to attach to the java application from the command line. But our aim is to send this information to another java process (Front End).
So we have a Java application- Front end querying for information from the JVMTI Agents (Back-End). These agents should be able to attach to the running java application we are going to inspect dynamically. Any ideas on how this can be done? Or has anyone tried this before?
The JDK has a built-in Java api for remote/local debug (com.sun.jdi.).
To quickly start using the api, you can look at examples in $JDK_DIR\demo\jpda\examples.jar. [More details]
Since the official examples are not so clear, here is reusable example (inspired by this blog post):
VMAcquirer.java (Connection manager)
Monitor.java (Actual monitoring)
Required by the application being monitor
Informations available through JDWP