Example usage for android.database.sqlite SQLiteDatabase isDbLockedByOtherThreads

List of usage examples for android.database.sqlite SQLiteDatabase isDbLockedByOtherThreads

Introduction

In this page you can find the example usage for android.database.sqlite SQLiteDatabase isDbLockedByOtherThreads.

Prototype

@Deprecated
public boolean isDbLockedByOtherThreads() 

Source Link

Document

Always returns false.

Usage

From source file:org.thomnichols.android.gmarks.WebViewCookiesDB.java

protected SQLiteDatabase openDatabase(final int mode) {
    File dbPath = ctx.getDatabasePath(DATABASE);
    if (!dbPath.exists())
        return null;
    try {/*from  w  w w.  j a v a 2s. c  om*/
        SQLiteDatabase db = SQLiteDatabase.openDatabase(dbPath.getPath(), null, mode);
        while (db.isDbLockedByOtherThreads()) {
            Log.w(TAG, "Waiting for other thread to flush DB");
            try {
                Thread.sleep(200);
            } catch (InterruptedException ex) {
            }
        }
        return db;
    } catch (SQLiteException ex) {
        Log.w(TAG, "Error opening database", ex);
        return null;
    }
}