diff options
author | Vasu Nori <vnori@google.com> | 2010-02-24 12:54:20 -0800 |
---|---|---|
committer | Vasu Nori <vnori@google.com> | 2010-02-26 11:02:32 -0800 |
commit | d606b4bf2c1a2308b40785860853cfb95a77bf58 (patch) | |
tree | 0f36974eb50153a99b8b030bfbe26f0c232d1875 /core/java/android/database/sqlite/SQLiteCursor.java | |
parent | a834949aff24358eb8c002d96df28be3e391ef4d (diff) | |
download | frameworks_base-d606b4bf2c1a2308b40785860853cfb95a77bf58.zip frameworks_base-d606b4bf2c1a2308b40785860853cfb95a77bf58.tar.gz frameworks_base-d606b4bf2c1a2308b40785860853cfb95a77bf58.tar.bz2 |
in finalize() methods, log warnings if db lock is going to be held.
this is to track bug:2463988 and bug:2457342
Diffstat (limited to 'core/java/android/database/sqlite/SQLiteCursor.java')
-rw-r--r-- | core/java/android/database/sqlite/SQLiteCursor.java | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/core/java/android/database/sqlite/SQLiteCursor.java b/core/java/android/database/sqlite/SQLiteCursor.java index b178d4f..96ed297 100644 --- a/core/java/android/database/sqlite/SQLiteCursor.java +++ b/core/java/android/database/sqlite/SQLiteCursor.java @@ -62,9 +62,8 @@ public class SQLiteCursor extends AbstractWindowedCursor { /** A mapping of column names to column indices, to speed up lookups */ private Map<String, Integer> mColumnNameMap; - /** Used to find out where a cursor was allocated in case it never got - * released. */ - private StackTraceElement[] mStackTraceElements; + /** Used to find out where a cursor was allocated in case it never got released. */ + private Throwable mStackTrace; /** * mMaxRead is the max items that each cursor window reads @@ -208,11 +207,7 @@ public class SQLiteCursor extends AbstractWindowedCursor { String editTable, SQLiteQuery query) { // The AbstractCursor constructor needs to do some setup. super(); - - if (SQLiteDebug.DEBUG_ACTIVE_CURSOR_FINALIZATION) { - mStackTraceElements = new Exception().getStackTrace(); - } - + mStackTrace = new Exception().fillInStackTrace(); mDatabase = db; mDriver = driver; mEditTable = editTable; @@ -585,15 +580,9 @@ public class SQLiteCursor extends AbstractWindowedCursor { // if the cursor hasn't been closed yet, close it first if (mWindow != null) { close(); - Log.e(TAG, "Finalizing cursor that has not been deactivated or closed." - + " database = " + mDatabase.getPath() + ", table = " + mEditTable - + ", query = " + mQuery.mSql); - if (SQLiteDebug.DEBUG_ACTIVE_CURSOR_FINALIZATION) { - Log.d(TAG, "This cursor was created in:"); - for (StackTraceElement ste : mStackTraceElements) { - Log.d(TAG, " " + ste); - } - } + Log.e(TAG, "Finalizing a Cursor that has not been deactivated or closed. " + + "database = " + mDatabase.getPath() + ", table = " + mEditTable + + ", query = " + mQuery.mSql, mStackTrace); SQLiteDebug.notifyActiveCursorFinalized(); } else { if (Config.LOGV) { |