jclass lifecycle documentation
801075Sep 27 2010 — edited Sep 28 2010I am looking for some documentation that describes JNI in terms of the jclass lifecycle.
What I mean by this, is that if a singleton DLL/DSO was loaded but allows the creation of distinct Class types (for different ClassLoader), I'd like to understand better the interaction of that with JNI. For example can I attach an opaque pointer to a jclass/Class from JNI so allow the JNI part of the system to independantly track information relating to that specific instance of a Class.
Also the interaction with the DefineClass (and implied UndefineClass) mechanisms within Java, for example could a class be redefined or undefined (if no longer used by any existing Object), does JavaVM manage class unload callbacks to JNI, allowing the opaque pointer I stored in the jclass to be natively deallocated.
Of course I understand that usage of jclass is shared by multiple users, so the native code using the opaque point would be thread-safe and deadlock free.
I have looked as best I can at the old sun hosted foum and also skimmed through the JNI documentation but have been unable to find any reference to how ClassLoader/Class creation/destruction affect JNI.