diff --git a/redisson/src/main/java/org/redisson/jcache/JCache.java b/redisson/src/main/java/org/redisson/jcache/JCache.java index e3d128c76..cf898931d 100644 --- a/redisson/src/main/java/org/redisson/jcache/JCache.java +++ b/redisson/src/main/java/org/redisson/jcache/JCache.java @@ -26,7 +26,6 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.TimeUnit; import javax.cache.Cache; import javax.cache.CacheManager; @@ -69,10 +68,9 @@ import org.redisson.client.protocol.decoder.MapScanResult; import org.redisson.client.protocol.decoder.ObjectListReplayDecoder; import org.redisson.client.protocol.decoder.ScanObjectEntry; import org.redisson.connection.decoder.MapGetAllDecoder; -import org.redisson.misc.Hash; - import org.redisson.jcache.JMutableEntry.Action; import org.redisson.jcache.configuration.JCacheConfiguration; +import org.redisson.misc.Hash; import io.netty.util.internal.ThreadLocalRandom; @@ -314,7 +312,7 @@ public class JCache extends RedissonObject implements Cache { V load(K key) { RLock lock = getLock(key); - lock.lock(30, TimeUnit.MINUTES); + lock.lock(); try { V value = getValueLocked(key); if (value == null) { @@ -703,7 +701,7 @@ public class JCache extends RedissonObject implements Cache { try { if (!containsKey(key) || replaceExistingValues) { RLock lock = getLock(key); - lock.lock(30, TimeUnit.MINUTES); + lock.lock(); try { if (!containsKey(key)|| replaceExistingValues) { V value; @@ -743,7 +741,7 @@ public class JCache extends RedissonObject implements Cache { private RLock getLockedLock(K key) { String lockName = getLockName(key); RLock lock = redisson.getLock(lockName); - lock.lock(30, TimeUnit.MINUTES); + lock.lock(); return lock; } @@ -761,7 +759,7 @@ public class JCache extends RedissonObject implements Cache { long startTime = currentNanoTime(); if (config.isWriteThrough()) { RLock lock = getLock(key); - lock.lock(30, TimeUnit.MINUTES); + lock.lock(); try { List result = getAndPutValueLocked(key, value); if (result.isEmpty()) { @@ -971,7 +969,7 @@ public class JCache extends RedissonObject implements Cache { long startTime = currentNanoTime(); if (config.isWriteThrough()) { RLock lock = getLock(key); - lock.lock(30, TimeUnit.MINUTES); + lock.lock(); try { List result = getAndPutValueLocked(key, value); if (result.isEmpty()) { @@ -1069,7 +1067,7 @@ public class JCache extends RedissonObject implements Cache { long startTime = currentNanoTime(); if (config.isWriteThrough()) { RLock lock = getLock(key); - lock.lock(30, TimeUnit.MINUTES); + lock.lock(); List result = getAndPutValue(key, value); if (result.isEmpty()) { @@ -1091,7 +1089,7 @@ public class JCache extends RedissonObject implements Cache { if (result.size() == 4) { val = (V) result.get(1); } - + deletedKeys.put(key, val); } cacheManager.getStatBean(this).addPuts(1); @@ -1173,7 +1171,7 @@ public class JCache extends RedissonObject implements Cache { long startTime = currentNanoTime(); if (config.isWriteThrough()) { RLock lock = getLock(key); - lock.lock(30, TimeUnit.MINUTES); + lock.lock(); try { boolean result = putIfAbsentValueLocked(key, value); if (result) { @@ -1255,7 +1253,7 @@ public class JCache extends RedissonObject implements Cache { long startTime = System.currentTimeMillis(); if (config.isWriteThrough()) { RLock lock = getLock(key); - lock.lock(30, TimeUnit.MINUTES); + lock.lock(); try { V oldValue = getValue(key); boolean result = removeValue(key); @@ -1396,7 +1394,7 @@ public class JCache extends RedissonObject implements Cache { boolean result; if (config.isWriteThrough()) { RLock lock = getLock(key); - lock.lock(30, TimeUnit.MINUTES); + lock.lock(); try { result = removeValueLocked(key, value); if (result) { @@ -1488,7 +1486,7 @@ public class JCache extends RedissonObject implements Cache { long startTime = currentNanoTime(); if (config.isWriteThrough()) { RLock lock = getLock(key); - lock.lock(30, TimeUnit.MINUTES); + lock.lock(); try { Object value = getAndRemoveValue(key); if (value != null) { @@ -1691,7 +1689,7 @@ public class JCache extends RedissonObject implements Cache { long startTime = currentNanoTime(); if (config.isWriteThrough()) { RLock lock = getLock(key); - lock.lock(30, TimeUnit.MINUTES); + lock.lock(); try { long result = replaceValueLocked(key, oldValue, newValue); if (result == 1) { @@ -1935,7 +1933,7 @@ public class JCache extends RedissonObject implements Cache { long startTime = currentNanoTime(); if (config.isWriteThrough()) { RLock lock = getLock(key); - lock.lock(30, TimeUnit.MINUTES); + lock.lock(); try { boolean result = replaceValueLocked(key, value); if (result) { @@ -1989,7 +1987,7 @@ public class JCache extends RedissonObject implements Cache { long startTime = currentNanoTime(); if (config.isWriteThrough()) { RLock lock = getLock(key); - lock.lock(30, TimeUnit.MINUTES); + lock.lock(); try { V result = getAndReplaceValueLocked(key, value); if (result != null) { @@ -2047,7 +2045,7 @@ public class JCache extends RedissonObject implements Cache { if (config.isWriteThrough()) { for (K key : keys) { RLock lock = getLock(key); - lock.lock(30, TimeUnit.MINUTES); + lock.lock(); V result = getAndRemoveValue(key); if (result != null) { deletedKeys.put(key, result);