Avik’s Ruminations

Musings on technology and life by Avik Sengupta

Dynamically adding instrumentation agents in Java

without comments

I’ve not seen much application (as opposed to framework level) use  of the  instrumentation api very much. While it seems like a goldmine of possibilities, one difficulty has been the inability to load an agent dynamically in a VM (ie, without using a command line option)  However, the OpenJPA has an interesting implementation of InstrumentationFactory that uses the Attach API to load the agent. (via Peter Royal)

Also part of that class is a cool, if hacky, method to get the PID of the running VM: a simple requirement that many have torn hair over.

Written by

March 20th, 2009 at 11:58 pm

Posted in Technology

Tagged with