|
@@ -1,13 +1,13 @@
|
|
|
package com.css.simulation.resource.scheduler.common.configuration.redis;
|
|
|
|
|
|
import api.common.util.CollectionUtil;
|
|
|
-import lombok.Synchronized;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Collection;
|
|
|
import java.util.Set;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
@Component
|
|
|
public class CustomRedisClient {
|
|
@@ -43,8 +43,7 @@ public class CustomRedisClient {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Synchronized
|
|
|
public Boolean getDistributedLock(String key) {
|
|
|
- return stringRedisTemplate.opsForValue().setIfAbsent(key, "1");
|
|
|
+ return stringRedisTemplate.opsForValue().setIfAbsent(key, "1", 10L, TimeUnit.SECONDS);
|
|
|
}
|
|
|
}
|