Why I should not reuse a jclass and/or jmethodID in JNI?

后端 未结 5 905
误落风尘
误落风尘 2020-12-07 16:34

This is a question related to a previous post, but this post was solved and now I wanted to change the direction of the question.

When working with JNI, it is necess

5条回答
  •  长情又很酷
    2020-12-07 17:19

    As I remember jclass is will be local to the calling method so can't be cached, however the method id can be. See http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/design.html for more detaild info.

    Sorry, I don't know about the performance aspect, any time I've used JNI it has been insignificant compared to the task in hand.

提交回复
热议问题