From: Damyan Ivanov Date: Tue, 31 Dec 2019 15:44:50 +0000 (+0200) Subject: use non-exclusive mode for write-enabled transactions X-Git-Tag: v0.12.0~111 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=9636e8ab222678637a0bac3c7f6dd7d43f8768e9;p=mobile-ledger.git use non-exclusive mode for write-enabled transactions --- diff --git a/app/src/main/java/net/ktnx/mobileledger/async/CommitAccountsTask.java b/app/src/main/java/net/ktnx/mobileledger/async/CommitAccountsTask.java index bde0156f..00b33336 100644 --- a/app/src/main/java/net/ktnx/mobileledger/async/CommitAccountsTask.java +++ b/app/src/main/java/net/ktnx/mobileledger/async/CommitAccountsTask.java @@ -38,7 +38,7 @@ public class CommitAccountsTask try { SQLiteDatabase db = App.getDatabase(); - db.beginTransaction(); + db.beginTransactionNonExclusive(); try { try (LockHolder lh = params[0].accountList.lockForWriting()) { for (int i = 0; i < params[0].accountList.size(); i++ ){ diff --git a/app/src/main/java/net/ktnx/mobileledger/async/RefreshDescriptionsTask.java b/app/src/main/java/net/ktnx/mobileledger/async/RefreshDescriptionsTask.java index 62885c1b..4276e97d 100644 --- a/app/src/main/java/net/ktnx/mobileledger/async/RefreshDescriptionsTask.java +++ b/app/src/main/java/net/ktnx/mobileledger/async/RefreshDescriptionsTask.java @@ -39,7 +39,7 @@ public class RefreshDescriptionsTask extends AsyncTask { Data.backgroundTaskStarted(); try { - db.beginTransaction(); + db.beginTransactionNonExclusive(); try { db.execSQL("UPDATE description_history set keep=0"); try (Cursor c = db diff --git a/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java b/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java index 1f2eac73..53896db0 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java @@ -109,7 +109,7 @@ public final class MobileLedgerProfile { } public static void storeProfilesOrder() { SQLiteDatabase db = App.getDatabase(); - db.beginTransaction(); + db.beginTransactionNonExclusive(); try { int orderNo = 0; for (MobileLedgerProfile p : Data.profiles.getValue()) { @@ -204,7 +204,7 @@ public final class MobileLedgerProfile { } public void storeInDB() { SQLiteDatabase db = App.getDatabase(); - db.beginTransaction(); + db.beginTransactionNonExclusive(); try { // debug("profiles", String.format("Storing profile in DB: uuid=%s, name=%s, " + // "url=%s, permit_posting=%s, authEnabled=%s, " + @@ -323,7 +323,7 @@ public final class MobileLedgerProfile { public void removeFromDB() { SQLiteDatabase db = App.getDatabase(); debug("db", String.format("removing profile %s from DB", uuid)); - db.beginTransaction(); + db.beginTransactionNonExclusive(); try { Object[] uuid_param = new Object[]{uuid}; db.execSQL("delete from profiles where uuid=?", uuid_param);