The JVM TI specification (1.1.95) at:
http://download.java.net/jdk6/doc/platform/jvmti/jvmti.html
states as follows about native agent's shutdown (unloading) from VM:
--- Excerpt-from-spec ---
...
JNIEXPORT void JNICALL
Agent_OnUnload(JavaVM *vm)
This function will be called by the VM when the library is about to be unloaded.
The library will be unloaded and this function will be called if some platform
specific mechanism causes the unload (an unload mechanism is not specified in this
document) or the library is (in effect) unloaded by the termination of the VM
whether through normal termination or VM failure, including start-up failure.
...
This function can be used to clean-up resources allocated during Agent_OnLoad.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
--- End-of-excerpt-from-spec ---
That final statement (that is can be used to clean-up resources) should really
say "Agent_OnLoad or Agent_OnAttach" because it's unclear from the spec
when and how an agent which is loaded in Live Phase will be unloaded from VM.