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 26ea8900a2

This reverts commit 9ed172e23c.
pull/104/head
Tom Hacohen 5 years ago
parent 423fcf060c
commit 19b4e2a796

@ -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<Persistable>(configuration) {
val lock = ReentrantLock()
override fun <K : Any?, E : Persistable?> insert(entity: E, keyClass: Class<K>?): K {
lock.withLock {
return super.insert(entity, keyClass)
}
}
override fun <E : Persistable?> update(entity: E): E {
lock.withLock {
return super.update(entity)
}
}
override fun <E : Persistable?> update(entity: E, vararg attributes: Attribute<*, *>?): E {
lock.withLock {
return super.update(entity, *attributes)
}
}
override fun <E : Persistable?> upsert(entity: E): E {
lock.withLock {
return super.upsert(entity)
}
}
override fun <E : Persistable?> refresh(entity: E): E {
lock.withLock {
return super.refresh(entity)
}
}
override fun <E : Persistable?> refresh(entity: E, vararg attributes: Attribute<*, *>?): E {
lock.withLock {
return super.refresh(entity, *attributes)
}
}
override fun <E : Persistable?> refreshAll(entity: E): E {
lock.withLock {
return super.refreshAll(entity)
}
}
override fun <E : Persistable?> delete(entity: E): Void {
lock.withLock {
return super.delete(entity)
}
}
}
Loading…
Cancel
Save