/** * Close the database if it has been opened previously. This method acquires the exclusive lock before closing the * db -- it will block if other threads are in transactions. This method will throw an exception if called from * within a transaction. * <p> * It is not safe to call this method from within any of the database open or migration hooks (e.g. * {@link #onUpgrade(ISQLiteDatabase, int, int)}, {@link #onOpen(ISQLiteDatabase)}, * {@link #onMigrationFailed(MigrationFailedException)}), etc. * <p> * WARNING: Any open database resources (e.g. cursors) will be invalid after calling this method. Do not call this * method if any open cursors may be in use. */ public final void close() { acquireExclusiveLock(); try { closeLocked(); } finally { releaseExclusiveLock(); } }
closeLocked(); closeLocked(); throw new RuntimeException("Failed to open database"); closeLocked(); closeLocked(); throw e;
/** * Close the database if it has been opened previously. This method acquires the exclusive lock before closing the * db -- it will block if other threads are in transactions. This method will throw an exception if called from * within a transaction. * <p> * It is not safe to call this method from within any of the database open or migration hooks (e.g. * {@link #onUpgrade(ISQLiteDatabase, int, int)}, {@link #onOpen(ISQLiteDatabase)}, * {@link #onMigrationFailed(MigrationFailedException)}), etc. * <p> * WARNING: Any open database resources (e.g. cursors) will be invalid after calling this method. Do not call this * method if any open cursors may be in use. */ public final void close() { acquireExclusiveLock(); try { closeLocked(); } finally { releaseExclusiveLock(); } }
closeLocked(); closeLocked(); throw new RuntimeException("Failed to open database"); closeLocked(); closeLocked(); throw e;