pub fn block_on_jni<T: Send + 'static>(
env: &mut JNIEnv<'_>,
_context: &str,
fut: impl Future<Output = T> + Send + 'static,
) -> Option<T>Expand description
Block on a future from a JNI entry point, panic-safe.
- If a Tokio runtime is already active on this thread,
futis polled to completion inside that runtime (spawn + block_on the JoinHandle). - Otherwise the future runs on the process-wide JNI runtime.
- Any panic inside
futis caught and re-thrown to Java as acom.dunimd.ri.RiErrorinstead of aborting the JVM.
Returns None when a panic was caught (a Java exception is pending).