summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2010-04-01 17:52:41 +0000
committerBrian S. O'Neill <bronee@gmail.com>2010-04-01 17:52:41 +0000
commitac20b565dff260073334942842c32ae426b6b478 (patch)
treef116c762a813c30e4fbc29c0646161d2e361ad5e /src/main/java/com/amazon
parente4282e9fc025de087451711670c144bf73fc184a (diff)
Promptly release internal cursor map when scope is closed.
Diffstat (limited to 'src/main/java/com/amazon')
-rw-r--r--src/main/java/com/amazon/carbonado/txn/TransactionScope.java11
1 files changed, 9 insertions, 2 deletions
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<Txn> {
mActive.exit();
}
if (mCursors != null) {
- for (CursorList<TransactionImpl<Txn>> cursorList : mCursors.values()) {
- cursorList.closeCursors();
+ try {
+ for (CursorList<TransactionImpl<Txn>> 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;
}
}
}