F
FBergemann
(1) those methods of the JNIEnv *env seem to be NOT related to object
*instances*. So can i calculate values by those once, store and re-use
later without need to use NewGlobalRef()? Or might there result
problem e.g. due to the JAVA garbage collection?
(2) I *guess* i should only use NewGlobalRef() if it refers to
elements of the current object (refered by the kind of (jobject) _this
ptr as the 2nd argument of the native methods). This again seems to
make sense only if i expect multiple successive access to the same
instance by methods for the object (correct?)
(3) In that case (2): what is the best method to calculate and store
such references? As i don't would like to presume which native method
for an object is invoked 1st: Do i e.g. have to insert a native
preparation function in the beginning of *all* methods for the given
class? Or can i use the JAVA ctor(s) for that and embed a native
function there to set durable (global) references for the object?
(4) finally: does this kind of "reminding" of references for object
instances only make sense for singletons in JAVA? Otherwise i might
have to create my own container for a number of instances - e.g.
mapped by the given _this ptr(?)
- Thanks in advance!
Regards!
Frank
*instances*. So can i calculate values by those once, store and re-use
later without need to use NewGlobalRef()? Or might there result
problem e.g. due to the JAVA garbage collection?
(2) I *guess* i should only use NewGlobalRef() if it refers to
elements of the current object (refered by the kind of (jobject) _this
ptr as the 2nd argument of the native methods). This again seems to
make sense only if i expect multiple successive access to the same
instance by methods for the object (correct?)
(3) In that case (2): what is the best method to calculate and store
such references? As i don't would like to presume which native method
for an object is invoked 1st: Do i e.g. have to insert a native
preparation function in the beginning of *all* methods for the given
class? Or can i use the JAVA ctor(s) for that and embed a native
function there to set durable (global) references for the object?
(4) finally: does this kind of "reminding" of references for object
instances only make sense for singletons in JAVA? Otherwise i might
have to create my own container for a number of instances - e.g.
mapped by the given _this ptr(?)
- Thanks in advance!
Regards!
Frank