diff --git a/core/src/main/java/org/alfresco/util/cache/AbstractAsynchronouslyRefreshedCache.java b/core/src/main/java/org/alfresco/util/cache/AbstractAsynchronouslyRefreshedCache.java index 9f3749af32..b4aabb7db7 100644 --- a/core/src/main/java/org/alfresco/util/cache/AbstractAsynchronouslyRefreshedCache.java +++ b/core/src/main/java/org/alfresco/util/cache/AbstractAsynchronouslyRefreshedCache.java @@ -424,6 +424,7 @@ public abstract class AbstractAsynchronouslyRefreshedCache @Override public Void call() { + liveLock.writeLock().lock(); try { doCall(); @@ -444,6 +445,10 @@ public abstract class AbstractAsynchronouslyRefreshedCache } return null; } + finally + { + liveLock.writeLock().unlock(); + } } private void doCall() throws Exception diff --git a/repository/src/main/java/org/alfresco/repo/cache/DefaultSimpleCache.java b/repository/src/main/java/org/alfresco/repo/cache/DefaultSimpleCache.java index 376330e12e..977bf90458 100644 --- a/repository/src/main/java/org/alfresco/repo/cache/DefaultSimpleCache.java +++ b/repository/src/main/java/org/alfresco/repo/cache/DefaultSimpleCache.java @@ -150,24 +150,10 @@ public final class DefaultSimpleCache * @return true if the put resulted in a change in value, false otherwise. */ public boolean putAndCheckUpdate(K key, V value) - { - return putAndCheckUpdate(key, value, false); - } - - /** - * put method that may be used to check for updates in a thread-safe manner. - * - * @param includeNewCheck if true then we include the new value in the check - * @return true if the put resulted in a change in value, - * or if includeNewCheck is true and the put resulted in a new value, - * false otherwise. - */ - public boolean putAndCheckUpdate(K key, V value, boolean includeNewCheck) { AbstractMap.SimpleImmutableEntry kvp = new AbstractMap.SimpleImmutableEntry(key, value); AbstractMap.SimpleImmutableEntry priorKVP = cache.asMap().put(key, kvp); - - return (includeNewCheck && priorKVP == null) || (priorKVP != null && (!priorKVP.equals(kvp))); + return (priorKVP != null && (!priorKVP.equals(kvp))); } @Override diff --git a/repository/src/main/resources/alfresco/tx-cache-context.xml b/repository/src/main/resources/alfresco/tx-cache-context.xml index 6b47973f2c..8ab850ec58 100644 --- a/repository/src/main/resources/alfresco/tx-cache-context.xml +++ b/repository/src/main/resources/alfresco/tx-cache-context.xml @@ -136,7 +136,6 @@ - diff --git a/repository/src/test/java/org/alfresco/repo/cache/DefaultSimpleCacheTest.java b/repository/src/test/java/org/alfresco/repo/cache/DefaultSimpleCacheTest.java index 43d97ed8f6..7e18fbdf61 100644 --- a/repository/src/test/java/org/alfresco/repo/cache/DefaultSimpleCacheTest.java +++ b/repository/src/test/java/org/alfresco/repo/cache/DefaultSimpleCacheTest.java @@ -131,45 +131,6 @@ public class DefaultSimpleCacheTest extends SimpleCacheTestBase