android - Refactoring Realm to use threading -


decided give realm w/threading shot.

i have repository class method in push data realm. method transforming data needed. there 1 query method well, findallsorted() on data class , returns observable results.


i started first wrapping method code (including getting realm instance) in observables , doing .subscribeon(schedulers.single()).

insertions worked fine, doing realm.where(image::class.java).findall(...) throwing "need executed on thread looper". adding observeon(androidschedulers.mainthread) throws "objects can accessed on thread created". same story goes when refactored observables run on ui thread subscribeon.


so thought, i'll go step using realm integrated threading model instead (methods suffix async). right insertions don't work since realm spawning multiple unique threads each realm.executetransactionasync, "insert" operation run on pool-1-thread-1 thread, while "transform" operation run on pool-1-thread-2 so, obviously, "objects can accessed on thread created".

anybody here used realm threading? honest, feel fell practical joke. thanks!


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -