Source:
<code>public void run() { if (checkAndReportInvalidState()) { return; } matchingOffers = managementRealm.where(PermissionOffer.class) .equalTo("token", offerToken) <START> .findAllAsync(); <END> matchingOffers.addChangeListener(new RealmChangeListener<RealmResults<PermissionOffer>>() { @Override public void onChange(final RealmResults<PermissionOffer> offers) { if (checkAndReportInvalidState()) { return; } if (!offers.isEmpty()) { managementRealm.executeTransactionAsync(new Realm.Transaction() { @Override public void execute(Realm realm) { if (checkAndReportInvalidState()) { return; } RealmResults<PermissionOffer> offers = realm.where(PermissionOffer.class) .equalTo("token", offerToken) .findAll(); if (!offers.isEmpty()) { offers.deleteAllFromRealm(); } } }, new Realm.Transaction.OnSuccess() { @Override public void onSuccess() { matchingOffers.removeAllChangeListeners(); if (checkAndReportInvalidState()) { return; } final SyncSession session = SyncManager.getSession(managementRealmConfig); session.addUploadProgressListener(ProgressMode.CURRENT_CHANGES, new ProgressListener() { @Override public void onChange(Progress progress) { if (progress.isTransferComplete()) { session.removeProgressListener(this); handler.post(new Runnable() { @Override public void run() { if (checkAndReportInvalidState()) { return; } notifyCallbackWithSuccess(); } }); } } }); } }, new Realm.Transaction.OnError() { @Override public void onError(Throwable error) { matchingOffers.removeAllChangeListeners(); notifyCallbackError(new ObjectServerError(ErrorCode.UNKNOWN, error)); } }); } } }); }</code><technical_language>thread is this a looper is called AsyncTask</technical_language>

Target:
public void run() { if (checkAndReportInvalidState()) { return; } matchingOffers = managementRealm.where(PermissionOffer.class) .equalTo("token", offerToken) .findAllAsync(); matchingOffers.addChangeListener(new RealmChangeListener<RealmResults<PermissionOffer>>() { @Override public void onChange(final RealmResults<PermissionOffer> offers) { if (checkAndReportInvalidState()) { return; } if (!offers.isEmpty()) { managementRealm.executeTransactionAsync(new Realm.Transaction() { @Override public void execute(Realm realm) { if (checkAndReportInvalidState()) { return; } RealmResults<PermissionOffer> offers = realm.where(PermissionOffer.class) .equalTo("token", offerToken) .findAll(); if (!offers.isEmpty()) { offers.deleteAllFromRealm(); } } }, new Realm.Transaction.OnSuccess() { @Override public void onSuccess() { matchingOffers.removeAllChangeListeners(); if (checkAndReportInvalidState()) { return; } final SyncSession session = SyncManager.getSession(managementRealmConfig); session.addUploadProgressListener(ProgressMode.CURRENT_CHANGES, new ProgressListener() { @Override public void onChange(Progress progress) { if (progress.isTransferComplete()) { session.removeProgressListener(this); handler.post(new Runnable() { @Override public void run() { if (checkAndReportInvalidState()) { return; } notifyCallbackWithSuccess(); } }); } } }); } }, new Realm.Transaction.OnError() { @Override public void onError(Throwable error) { matchingOffers.removeAllChangeListeners(); notifyCallbackWithError(new ObjectServerError(ErrorCode.UNKNOWN, error)); } }); } } }); }