-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: ObjectStore
Discovered in Java https://github.com/realm/realm-java/issues/7054
There seems to be a problem with Core 6 and Notifications in some corner cases. The above error is a sporadic bug we are seeing in Java.
@Test @RunTestInLooperThread public void refresh_triggerNotifications() { final CountDownLatch bgThreadDone = new CountDownLatch(1); final AtomicBoolean listenerCalled = new AtomicBoolean(false); Realm realm = looperThread.getRealm(); RealmResults<AllTypes> results = realm.where(AllTypes.class).findAll(); assertEquals(0, results.size()); results.addChangeListener(new RealmChangeListener<RealmResults<AllTypes>>() { @Override public void onChange(RealmResults<AllTypes> results) { assertEquals(1, results.size()); listenerCalled.set(true); } }); // Advance the Realm on a background while blocking this thread. When we refresh, it should trigger // the listener. new Thread(new Runnable() { @Override public void run() { Realm realm = Realm.getInstance(looperThread.getConfiguration()); realm.beginTransaction(); realm.createObject(AllTypes.class); realm.commitTransaction(); realm.close(); bgThreadDone.countDown(); } }).start(); TestHelper.awaitOrFail(bgThreadDone); realm.refresh(); assertTrue(listenerCalled.get()); looperThread.testComplete(); }
This is the Java test. Basicially it just does a background write and ensures that calling Realm.refresh() correctly trigger notifications.
- is related to
-
RCORE-295 NoSuchTable thrown from import_copy_of()
- Closed