cargo jni 0.13.0
Rust JNI 0.13.0

latest releases: 0.21.1, 0.21.0, 0.20.0...
5 years ago

0.13 brings major improvements in thread management, allowing to attach the native threads
permanently and safely; Executor for extra convenience and safety; and other
improvements and fixes.

⚠️ If your code attaches native threads — make sure to check the updated documentation
of JavaVM to learn about the new features!

Added

  • JavaVM::attach_current_thread_permanently method, which attaches the current
    thread and detaches it when the thread finishes. Daemon threads attached
    with JavaVM::attach_current_thread_as_daemon also automatically detach themselves
    when finished. The number of currently attached threads may be acquired using
    JavaVM::threads_attached method. (#179, #180)
  • Executor — a simple thread attachment manager which helps to safely
    execute a closure in attached thread context and to automatically free
    created local references at closure exit. (#186)

Changed

  • The default JNI API version in InitArgsBuilder from V1 to V8. (#178)
  • Extended the lifetimes of AutoLocal to make it more flexible. (#190)
  • Default exception type from checked java.lang.Exception to unchecked java.lang.RuntimeException.
    It is used implicitly when JNIEnv#throw is invoked with exception message:
    env.throw("Exception message"); however, for efficiency reasons, it is recommended
    to specify the exception type explicitly and use throw_new:
    env.throw_new(exception_type, "Exception message"). (#194)

Fixed

  • Native threads attached with JavaVM::attach_current_thread_as_daemon now automatically detach
    themselves on exit, preventing Java Thread leaks. (#179)
  • Local reference leaks in JList, JMap and JMapIter. (#190, #191)

Don't miss a new jni release

NewReleases is sending notifications on new releases.