Archive for the ‘java’ tag
Dynamically adding instrumentation agents in Java
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.