|
|
@@ -278,10 +278,12 @@ public class RedissonUtils {
|
|
|
*/
|
|
|
public static void unlock(String lockKey) {
|
|
|
RLock lock = redissonUtils.redissonClient.getLock(lockKey);
|
|
|
- lock.unlock();
|
|
|
+ if (lock.isLocked() && lock.isHeldByCurrentThread()) {
|
|
|
+ lock.unlock();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- public static Long getAtomicLong(String name,Long expired) {
|
|
|
+ public static Long getAtomicLong(String name, Long expired) {
|
|
|
RAtomicLong atomicLong = redissonUtils.redissonClient.getAtomicLong(name);
|
|
|
long number = atomicLong.incrementAndGet();
|
|
|
atomicLong.expire(expired <= 0 ? Duration.ofSeconds(DEFAULT_EXPIRED) : Duration.ofSeconds(expired));
|