diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-12 21:07:36 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-12 21:07:36 +0200 |
commit | 30b2eb185c3271e72d042aded53001aa95e5ccfb (patch) | |
tree | 72ee16db2d374b0e7ddcbe993f69d77d70e20f9a /src/main/java/de/pixart/messenger/services | |
parent | 73f5a097dd4de8291aad7a312c78719f91bbbef5 (diff) |
run roster sync in replacing task manager
Diffstat (limited to 'src/main/java/de/pixart/messenger/services')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index d83a2fd7f..5537297a6 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -117,6 +117,7 @@ import de.pixart.messenger.utils.OnPhoneContactsLoadedListener; import de.pixart.messenger.utils.PRNGFixes; import de.pixart.messenger.utils.PhoneHelper; import de.pixart.messenger.utils.ReplacingSerialSingleThreadExecutor; +import de.pixart.messenger.utils.ReplacingTaskManager; import de.pixart.messenger.utils.Resolver; import de.pixart.messenger.utils.SerialSingleThreadExecutor; import de.pixart.messenger.utils.XmppUri; @@ -169,6 +170,7 @@ public class XmppConnectionService extends Service { private final SerialSingleThreadExecutor mDatabaseWriterExecutor = new SerialSingleThreadExecutor("DatabaseWriter"); private final SerialSingleThreadExecutor mDatabaseReaderExecutor = new SerialSingleThreadExecutor("DatabaseReader"); private final SerialSingleThreadExecutor mNotificationExecutor = new SerialSingleThreadExecutor("NotificationExecutor"); + private final ReplacingTaskManager mRosterSyncTaskManager = new ReplacingTaskManager(); private final IBinder mBinder = new XmppConnectionBinder(); private final List<Conversation> conversations = new CopyOnWriteArrayList<>(); private final IqGenerator mIqGenerator = new IqGenerator(this); @@ -1636,7 +1638,7 @@ public class XmppConnectionService extends Service { } public void syncRoster(final Account account) { - mDatabaseWriterExecutor.execute(() -> databaseBackend.writeRoster(account.getRoster())); + mRosterSyncTaskManager.execute(account, () -> databaseBackend.writeRoster(account.getRoster())); } public List<Conversation> getConversations() { @@ -2089,6 +2091,7 @@ public class XmppConnectionService extends Service { }; mDatabaseWriterExecutor.execute(runnable); this.accounts.remove(account); + this.mRosterSyncTaskManager.clear(account); updateAccountUi(); getNotificationService().updateErrorNotification(); syncEnabledAccountSetting(); |