diff options
Diffstat (limited to 'src/main/java/com/amazon/carbonado/txn')
-rw-r--r-- | src/main/java/com/amazon/carbonado/txn/TransactionScope.java | 11 |
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;
}
}
}
|