The JNI docs state that local Java object references are in scope until the native method returns; also that they're local to the thread.
When an application hosts a Java VM, Java object references might be created outside of any native method. Once a JVM is running, the host app may obtain a
JNIEnv that can be used to create local references may be obtained through:
Agent_OnAttach entries. Local references created inside these entries are valid until the return from the entry.
All local references are only valid in the thread in which they are created. The native code must not pass local references from one thread to another.
jarray etc. are all JNI references like
jobject. They also need to be managed, unlike
jfieldID which are not JNI references.