Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 26ea890 This reverts commit 9ed172e.
- Loading branch information
Showing
1 changed file
with
0 additions
and
51 deletions.
There are no files selected for viewing
51 changes: 0 additions & 51 deletions
51
app/src/main/java/com/etesync/syncadapter/model/MyEntityDataStore.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} | ||
} |