I have a C application which embeds a JVM (of course JNI). I'm trying to do some profiling with JVMTI.
Is there any reason Agent_OnLoad would be called twice during the start of the JVM? I'm only calling JNI_CreateJavaVM once in the application I am attempting to profile using JVMTI but the code in Agent_OnLoad is getting executed twice.
I have many layers of architecture and a facility which handles parsing Java options on the behalf of my JNI applications. The agentpath option was getting set twice causing my agents to run twice. It has been my experience that the last Java option passed into the JVM overrides any prior instances of that particular option. I guess this is not true for agentlib or agentpath.
Hopefully tomorrow I'll find out that this conflict was the root cause of my JNI function Intercept issue I posted about earlier.