Android Realm repalce refresh with waitForChange -


after v0.91.0, deprecated methods in realm removed including refresh().

i've used refresh() below make sure realm instance has up-to-date data.

public static <t> t query(realmactionwithresult<t> runnable, t defaultvalue) {     realm realm = realm.getinstance(getconfiguration());     try {         realm.refresh();         return runnable.run(realm);     } catch (exception e) {         return defaultvalue;     } {         realm.close();     } } 

if replace refresh() waitforchange(), it's blocked until next change happens (of course in non-looper thread).

how can make not block current thread, pass when current realm up-to-date 1 or block if there should wait?

or if use realm above pattern (every time close it) in non-looper thread schedulers.io in rx, realm.getinstance() return newest snapshot because per-thread cached instance reference zero?

you don't have call refresh right after calling getinstance(). realm returned getinstance() date.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -