Browse Source

Synchronizing access to database

master
anthony restaino 8 years ago
parent
commit
fa2a7f039b
  1. 2
      app/src/main/java/acr/browser/lightning/database/bookmark/BookmarkDatabase.java
  2. 2
      app/src/main/java/acr/browser/lightning/database/downloads/DownloadsDatabase.java
  3. 2
      app/src/main/java/acr/browser/lightning/database/history/HistoryDatabase.java

2
app/src/main/java/acr/browser/lightning/database/bookmark/BookmarkDatabase.java

@ -75,7 +75,7 @@ public class BookmarkDatabase extends SQLiteOpenHelper implements BookmarkModel @@ -75,7 +75,7 @@ public class BookmarkDatabase extends SQLiteOpenHelper implements BookmarkModel
*/
@WorkerThread
@NonNull
private SQLiteDatabase lazyDatabase() {
private synchronized SQLiteDatabase lazyDatabase() {
if (mDatabase == null || !mDatabase.isOpen()) {
mDatabase = getWritableDatabase();
}

2
app/src/main/java/acr/browser/lightning/database/downloads/DownloadsDatabase.java

@ -68,7 +68,7 @@ public class DownloadsDatabase extends SQLiteOpenHelper implements DownloadsMode @@ -68,7 +68,7 @@ public class DownloadsDatabase extends SQLiteOpenHelper implements DownloadsMode
*/
@WorkerThread
@NonNull
private SQLiteDatabase lazyDatabase() {
private synchronized SQLiteDatabase lazyDatabase() {
if (mDatabase == null || !mDatabase.isOpen()) {
mDatabase = getWritableDatabase();
}

2
app/src/main/java/acr/browser/lightning/database/history/HistoryDatabase.java

@ -92,7 +92,7 @@ public class HistoryDatabase extends SQLiteOpenHelper implements HistoryModel { @@ -92,7 +92,7 @@ public class HistoryDatabase extends SQLiteOpenHelper implements HistoryModel {
@WorkerThread
@NonNull
private SQLiteDatabase lazyDatabase() {
private synchronized SQLiteDatabase lazyDatabase() {
if (mDatabase == null || !mDatabase.isOpen()) {
mDatabase = this.getWritableDatabase();
}

Loading…
Cancel
Save