title: In JNI, how do I cache the class, methodID, and fieldIDs per IBM's performance recommendations?
body: <p>I read on <a href="http://www.ibm.com/developerworks/java/library/j-jni/index.html#notc" rel="noreferrer">on IBM</a> that </p>
  
  <blockquote>
    <p>To access Java objects' fields and invoke their methods, native code
    must make calls to FindClass(), GetFieldID(), GetMethodId(), and
    GetStaticMethodID(). In the case of GetFieldID(), GetMethodID(), and
    GetStaticMethodID(), the IDs returned for a given class don't change
    for the lifetime of the JVM process. But the call to get the field or
    method can require significant work in the JVM, because fields and
    methods might have been inherited from superclasses, making the JVM
    walk up the class hierarchy to find them. Because the IDs are the same
    for a given class, you should look them up once and then reuse them.
    Similarly, looking up class objects can be expensive, so they should
    be cached as well.</p>
  </blockquote>
  
  <p>How does one <strong>cache</strong> the <code>methodID</code>, <code>fieldID</code>, and <code>class</code> objects in JNI?
  Are there built-in methods or a specific procedure that has to be followed?</p>