diff --git a/source/java/org/alfresco/repo/cache/CacheTest.java b/source/java/org/alfresco/repo/cache/CacheTest.java index a07a133616..80b2adc76c 100644 --- a/source/java/org/alfresco/repo/cache/CacheTest.java +++ b/source/java/org/alfresco/repo/cache/CacheTest.java @@ -709,6 +709,28 @@ public class CacheTest extends TestCase }; executeAndCheck(callback, COMMON_KEY, null); } + /** + * + */ + public void testConcurrentRemoveAgainstUpdate_NoPreExisting()throws Throwable + { + RetryingTransactionCallback callback = new RetryingTransactionCallback() + { + public Object execute() throws Throwable + { + backingCache.remove(COMMON_KEY); + transactionalCache.remove(COMMON_KEY); + backingCache.put(COMMON_KEY, "aaa2"); + return null; + } + }; + executeAndCheck(callback, COMMON_KEY, null); + } /** * */ - public void testConcurrentRemoveAgainstUpdate()throws Throwable + public void testConcurrentRemoveAgainstUpdate_PreExisting()throws Throwable { RetryingTransactionCallback callback = new RetryingTransactionCallback() { diff --git a/source/java/org/alfresco/repo/cache/TransactionalCache.java b/source/java/org/alfresco/repo/cache/TransactionalCache.java index c745741404..e29f78fe3a 100644 --- a/source/java/org/alfresco/repo/cache/TransactionalCache.java +++ b/source/java/org/alfresco/repo/cache/TransactionalCache.java @@ -503,16 +503,8 @@ public class TransactionalCache } else { - V existingValue = getSharedCacheValue(key); - if (existingValue == null) - { - // There is no point doing a remove for a value that doesn't exist - } - else - { - // Create a bucket to remove the value from the shared cache - txnData.removedItemsCache.add(key); - } + // Create a bucket to remove the value from the shared cache + txnData.removedItemsCache.add(key); } } // remove the item from the udpated cache, if present