From ac20b565dff260073334942842c32ae426b6b478 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Thu, 1 Apr 2010 17:52:41 +0000 Subject: Promptly release internal cursor map when scope is closed. --- src/main/java/com/amazon/carbonado/txn/TransactionScope.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/amazon/carbonado/txn/TransactionScope.java b/src/main/java/com/amazon/carbonado/txn/TransactionScope.java index 529cad5..98a1210 100644 --- a/src/main/java/com/amazon/carbonado/txn/TransactionScope.java +++ b/src/main/java/com/amazon/carbonado/txn/TransactionScope.java @@ -302,8 +302,15 @@ public class TransactionScope { mActive.exit(); } if (mCursors != null) { - for (CursorList> cursorList : mCursors.values()) { - cursorList.closeCursors(); + try { + for (CursorList> cursorList : mCursors.values()) { + cursorList.closeCursors(); + } + } finally { + // Ensure that map is freed promptly. Thread-local + // reference to this scope otherwise keeps map and its + // contents lingering around for a very long time. + mCursors = null; } } } -- cgit v1.2.3