Uploaded image for project: 'Realm Core'
  1. Realm Core
  2. RCORE-1300

[C-API] Expose BindingCallbackThreadObserver so the JVM can correctly shut down

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None

      On JVM platforms we need a way to attach the Sync Client C++ thread to Java in order to communicate with it and detach it afterward in order to correctly shut down the JVM. Realm Kotlin accidentally did attach it in some other code, but detaching is currently impossible.

      In ObjectStore this global variable exists https://github.com/realm/realm-core/blob/master/src/realm/object-store/binding_callback_thread_observer.hpp#L39, which is being used by the Java SDK here with implementation here

      We need a similar mechanism in the C-API in order to correctly clean up when closing Realms and Apps in Realm Kotlin.

      Note, the current behavior in ObjectStore is a bit suboptimal since the same callback is used across all apps, so having a callback that is scoped to a single app would be ideal. But the current implementation is enough for our current use case.

            Assignee:
            nicola.cabiddu@mongodb.com Nicola Cabiddu
            Reporter:
            christian.melchior@mongodb.com Christian Melchior (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: