Java Code Examples for android.database.sqlite.SQLiteDatabase#isDbLockedByCurrentThread()
The following examples show how to use
android.database.sqlite.SQLiteDatabase#isDbLockedByCurrentThread() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogTransaction.java From nRF-Logger-API with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Completes the transaction, ending the DB transactions for all associated databases. * * @param callerIsBatch whether this is being performed in the context of a batch operation. * If it is not, and the transaction is marked as batch, this call is * a no-op. */ void finish(boolean callerIsBatch) { if (!mBatch || callerIsBatch) { for (SQLiteDatabase db : mDatabasesForTransaction) { // If an exception was thrown while yielding, it's possible that we no longer have // a lock on this database, so we need to check before attempting to end its // transaction. Otherwise, we should always expect to be in a transaction (and will // throw an exception if this is not the case). if (mYieldFailed && !db.isDbLockedByCurrentThread()) { // We no longer hold the lock, so don't do anything with this database. continue; } db.endTransaction(); } mDatabasesForTransaction.clear(); mDatabaseTagMap.clear(); mIsDirty = false; } }
Example 2
Source File: Service.java From Twire with GNU General Public License v3.0 | 4 votes |
private static boolean isDbSafe(SQLiteDatabase db) { return db.isOpen() && !db.isReadOnly() && !db.isDbLockedByCurrentThread(); }
Example 3
Source File: Service.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 4 votes |
private static boolean isDbSafe(SQLiteDatabase db) { return db.isOpen() && !db.isReadOnly() && !db.isDbLockedByCurrentThread(); }