From 19b4e2a7967f070b33781c4d23e9192ae01a0284 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Mon, 4 Nov 2019 10:41:47 +0200 Subject: [PATCH] Revert "Add a reentrant lock to our entity data store." I'm pretty sure this was causing the recent issues with tasks and events disappearing as described in #97. Regardless of this, it's not actually needed as SQLite on Android is already thread-safe. The SQLite locks some users were experiencing were probably fixed in 26ea8900a200d3b4c3accc730c03928b966af63d This reverts commit 9ed172e23c57aaa3ee7d2d2f43c1e7c85a2c8c7b. --- .../syncadapter/model/MyEntityDataStore.kt | 51 ------------------- 1 file changed, 51 deletions(-) diff --git a/app/src/main/java/com/etesync/syncadapter/model/MyEntityDataStore.kt b/app/src/main/java/com/etesync/syncadapter/model/MyEntityDataStore.kt index 4ef9d39f..4df62d15 100644 --- a/app/src/main/java/com/etesync/syncadapter/model/MyEntityDataStore.kt +++ b/app/src/main/java/com/etesync/syncadapter/model/MyEntityDataStore.kt @@ -1,60 +1,9 @@ package com.etesync.syncadapter.model import io.requery.Persistable -import io.requery.meta.Attribute import io.requery.sql.Configuration import io.requery.sql.EntityDataStore -import java.util.concurrent.locks.ReentrantLock -import kotlin.concurrent.withLock class MyEntityDataStore(configuration: Configuration): EntityDataStore(configuration) { - val lock = ReentrantLock() - override fun insert(entity: E, keyClass: Class?): K { - lock.withLock { - return super.insert(entity, keyClass) - } - } - - override fun update(entity: E): E { - lock.withLock { - return super.update(entity) - } - } - - override fun update(entity: E, vararg attributes: Attribute<*, *>?): E { - lock.withLock { - return super.update(entity, *attributes) - } - } - - override fun upsert(entity: E): E { - lock.withLock { - return super.upsert(entity) - } - } - - override fun refresh(entity: E): E { - lock.withLock { - return super.refresh(entity) - } - } - - override fun refresh(entity: E, vararg attributes: Attribute<*, *>?): E { - lock.withLock { - return super.refresh(entity, *attributes) - } - } - - override fun refreshAll(entity: E): E { - lock.withLock { - return super.refreshAll(entity) - } - } - - override fun delete(entity: E): Void { - lock.withLock { - return super.delete(entity) - } - } } \ No newline at end of file