From e322a0a9d3434f6dd81027a9a1727bb46ff82dd3 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Tue, 8 Jul 2014 11:31:55 -0500 Subject: [PATCH] Depth Check to handle recursion on storage interests. --- me/helpers/StorageInterestManager.java | 27 +++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/me/helpers/StorageInterestManager.java b/me/helpers/StorageInterestManager.java index c4e9761f8..4917e6e1e 100644 --- a/me/helpers/StorageInterestManager.java +++ b/me/helpers/StorageInterestManager.java @@ -25,6 +25,7 @@ public class StorageInterestManager { private final SetMultimap container; private LinkedList transactions = null; + private int transDepth=0; public StorageInterestManager(SetMultimap interests) { container = interests; @@ -32,20 +33,28 @@ public class StorageInterestManager { public void enableTransactions() { - transactions = new LinkedList(); + if ( transDepth == 0 ) + transactions = new LinkedList(); + + transDepth++; } public void disableTransactions() { - LinkedList myActions = transactions; - transactions = null; - - for ( SavedTransactions t : myActions ) + transDepth--; + + if ( transDepth == 0 ) { - if ( t.put ) - put( t.stack, t.iw ); - else - remove( t.stack, t.iw ); + LinkedList myActions = transactions; + transactions = null; + + for ( SavedTransactions t : myActions ) + { + if ( t.put ) + put( t.stack, t.iw ); + else + remove( t.stack, t.iw ); + } } }