Source:
private void completedAsyncQueriesUpdate(QueryUpdateTask.Result result) { SharedGroup.VersionID callerVersionID = realm.sharedGroupManager.getVersion(); int compare = callerVersionID.compareTo(result.versionID); if (compare > 0) { RealmLog.d("COMPLETED_UPDATE_ASYNC_QUERIES realm:" + HandlerController.this + " caller is more advanced, Looper will updates queries"); } else { if (compare != 0) { RealmLog.d("COMPLETED_UPDATE_ASYNC_QUERIES realm:"+ HandlerController.this + " caller is behind advance_read"); try { realm.sharedGroupManager.advanceRead(result.versionID); } catch (BadVersionException e) { throw new IllegalStateException("Failed to advance Caller Realm to Worker Realm version", e); } } ArrayList<RealmResults<? extends RealmModel>> callbacksToNotify = new ArrayList<RealmResults<? extends RealmModel>>(result.updatedTableViews.size()); for (Map.Entry<WeakReference<RealmResults<? extends RealmModel>>, Long> query : result.updatedTableViews.entrySet()) { WeakReference<RealmResults<? extends RealmModel>> weakRealmResults = query.getKey(); RealmResults<? extends RealmModel> realmResults = weakRealmResults.get(); if (realmResults == null) { asyncRealmResults.remove(weakRealmResults); } else { realmResults.swapTableViewPointer(query.getValue()); callbacksToNotify.add(realmResults); RealmLog.d("COMPLETED_UPDATE_ASYNC_QUERIES realm:"+ HandlerController.this + " updating RealmResults " + weakRealmResults); } } for (RealmResults<? extends RealmModel> query : callbacksToNotify) { query.notifyChangeListeners(); } notifyGlobalListeners(); notifySyncRealmResultsCallbacks(); notifyRealmObjectCallbacks(); updateAsyncQueriesTask = null; } executeAsyncTransactionCallbacks(); }

Target:
private void completedAsyncQueriesUpdate(QueryUpdateTask.Result result) { SharedGroup.VersionID callerVersionID = realm.sharedGroupManager.getVersion(); int compare = callerVersionID.compareTo(result.versionID); if (compare > 0) { RealmLog.d("COMPLETED_UPDATE_ASYNC_QUERIES realm:" + HandlerController.this + " caller is more advanced, Looper will updates queries"); } else { if (compare != 0) { RealmLog.d("COMPLETED_UPDATE_ASYNC_QUERIES realm:"+ HandlerController.this + " caller is behind advance_read"); try { realm.sharedGroupManager.advanceRead(result.versionID); } catch (BadVersionException e) { throw new IllegalStateException("Failed to advance Caller Realm to Worker Realm version", e); } } ArrayList<RealmResults<? extends RealmModel>> resultsToBeNotified = new ArrayList<RealmResults<? extends RealmModel>>(result.updatedTableViews.size()); for (Map.Entry<WeakReference<RealmResults<? extends RealmModel>>, Long> query : result.updatedTableViews.entrySet()) { WeakReference<RealmResults<? extends RealmModel>> weakRealmResults = query.getKey(); RealmResults<? extends RealmModel> realmResults = weakRealmResults.get(); if (realmResults == null) { asyncRealmResults.remove(weakRealmResults); } else { realmResults.swapTableViewPointer(query.getValue()); realmResults.syncIfNeeded(); resultsToBeNotified.add(realmResults); RealmLog.d("COMPLETED_UPDATE_ASYNC_QUERIES realm:"+ HandlerController.this + " updating RealmResults " + weakRealmResults); } } collectSyncRealmResultsCallbacks(resultsToBeNotified); notifyAllListeners(resultsToBeNotified); updateAsyncQueriesTask = null; } }