Adds some additional eager cache invalidation to ensure we don't use stale nodes

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1301145 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2012-03-15 18:57:13 +00:00
parent d4cd7f9eed
commit eab8758529
1 changed files with 7 additions and 0 deletions

View File

@ -155,6 +155,7 @@ public class ListIndex<Key,Value> implements Index<Key,Value> {
oldValue = lastGetEntryCache.setValue(value);
lastGetEntryCache.setValue(value);
lastGetNodeCache.storeUpdate(tx);
flushCache();
return oldValue;
}
@ -166,6 +167,7 @@ public class ListIndex<Key,Value> implements Index<Key,Value> {
if (entry.getKey().equals(key)) {
oldValue = entry.setValue(value);
((ListIterator) iterator).getCurrent().storeUpdate(tx);
flushCache();
return oldValue;
}
}
@ -182,11 +184,14 @@ public class ListIndex<Key,Value> implements Index<Key,Value> {
if (entry.getKey().equals(key)) {
oldValue = entry.setValue(value);
((ListIterator) iterator).getCurrent().storeUpdate(tx);
flushCache();
return oldValue;
}
}
// Not found so add it last.
flushCache();
return add(tx, key, value);
}
@ -194,6 +199,7 @@ public class ListIndex<Key,Value> implements Index<Key,Value> {
assertLoaded();
getTail(tx).put(tx, key, value);
size.incrementAndGet();
flushCache();
return null;
}
@ -201,6 +207,7 @@ public class ListIndex<Key,Value> implements Index<Key,Value> {
assertLoaded();
getHead(tx).addFirst(tx, key, value);
size.incrementAndGet();
flushCache();
return null;
}