Prevent JNI to be garbage collected