Depth Check to handle recursion on storage interests.
This commit is contained in:
parent
40e71566ea
commit
e322a0a9d3
1 changed files with 18 additions and 9 deletions
|
@ -25,6 +25,7 @@ public class StorageInterestManager {
|
||||||
|
|
||||||
private final SetMultimap<IAEStack, ItemWatcher> container;
|
private final SetMultimap<IAEStack, ItemWatcher> container;
|
||||||
private LinkedList<SavedTransactions> transactions = null;
|
private LinkedList<SavedTransactions> transactions = null;
|
||||||
|
private int transDepth=0;
|
||||||
|
|
||||||
public StorageInterestManager(SetMultimap<IAEStack, ItemWatcher> interests) {
|
public StorageInterestManager(SetMultimap<IAEStack, ItemWatcher> interests) {
|
||||||
container = interests;
|
container = interests;
|
||||||
|
@ -32,20 +33,28 @@ public class StorageInterestManager {
|
||||||
|
|
||||||
public void enableTransactions()
|
public void enableTransactions()
|
||||||
{
|
{
|
||||||
transactions = new LinkedList();
|
if ( transDepth == 0 )
|
||||||
|
transactions = new LinkedList();
|
||||||
|
|
||||||
|
transDepth++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disableTransactions()
|
public void disableTransactions()
|
||||||
{
|
{
|
||||||
LinkedList<SavedTransactions> myActions = transactions;
|
transDepth--;
|
||||||
transactions = null;
|
|
||||||
|
if ( transDepth == 0 )
|
||||||
for ( SavedTransactions t : myActions )
|
|
||||||
{
|
{
|
||||||
if ( t.put )
|
LinkedList<SavedTransactions> myActions = transactions;
|
||||||
put( t.stack, t.iw );
|
transactions = null;
|
||||||
else
|
|
||||||
remove( t.stack, t.iw );
|
for ( SavedTransactions t : myActions )
|
||||||
|
{
|
||||||
|
if ( t.put )
|
||||||
|
put( t.stack, t.iw );
|
||||||
|
else
|
||||||
|
remove( t.stack, t.iw );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue