Commit e6902c69 by huangfusuper

调整提示日志级别

parent 4d0caeab
...@@ -17,6 +17,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; ...@@ -17,6 +17,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
/** /**
* 分布式锁配置对象 * 分布式锁配置对象
...@@ -79,7 +80,7 @@ public class RedissonAutoConfiguration { ...@@ -79,7 +80,7 @@ public class RedissonAutoConfiguration {
* @return * @return
*/ */
@Bean @Bean
public DistributedLocker distributedLocker(RedissonClient redissonSingle) { public static DistributedLocker distributedLocker(RedissonClient redissonSingle) {
RedissonDistributedLocker locker = new RedissonDistributedLocker(); RedissonDistributedLocker locker = new RedissonDistributedLocker();
locker.setRedissonClient(redissonSingle); locker.setRedissonClient(redissonSingle);
log.info("----------redis分布式锁{},被设置加载---------",locker); log.info("----------redis分布式锁{},被设置加载---------",locker);
......
...@@ -46,12 +46,18 @@ public class DaemonScanThreadRunHelperRedisLock extends BaseDaemonScanThreadRunH ...@@ -46,12 +46,18 @@ public class DaemonScanThreadRunHelperRedisLock extends BaseDaemonScanThreadRunH
SCAN_WORLD_THREAD.execute(() ->{ SCAN_WORLD_THREAD.execute(() ->{
//初始化睡眠 //初始化睡眠
dateAligned(INIT_SLEEP_DATE,threadName); dateAligned(INIT_SLEEP_DATE,threadName);
log.info("---------------{}线程启动成功----------------",threadName); log.info("---------------{}线程启动成功----------------",threadName);
while (!THREAD_GROUP_STOP){ while (!THREAD_GROUP_STOP){
//定义睡眠变量 //定义睡眠变量
Long sleepTime = 0L; Long sleepTime = 0L;
try{ try{
log.debug("---{}准备加锁---",threadName); log.debug("---{}准备加锁---",threadName);
//自旋等待redis加载成功
while (RedissLockUtil.redissLock == null){
log.warn("{}等待redis加载成功...",threadName);
dateAligned(CYCLE_INTERVAL,threadName);
}
//加锁 60秒后超时 //加锁 60秒后超时
if (RedissLockUtil.trlock(lockName, TimeUnit.SECONDS, -1)) { if (RedissLockUtil.trlock(lockName, TimeUnit.SECONDS, -1)) {
log.debug("------------{},加锁成功,锁名称为{}----------",threadName,lockName); log.debug("------------{},加锁成功,锁名称为{}----------",threadName,lockName);
......
...@@ -7,7 +7,7 @@ import java.util.concurrent.TimeUnit; ...@@ -7,7 +7,7 @@ import java.util.concurrent.TimeUnit;
* @author huangfu * @author huangfu
*/ */
public class RedissLockUtil { public class RedissLockUtil {
private static DistributedLocker redissLock; public static DistributedLocker redissLock;
public static void setLocker(DistributedLocker locker) { public static void setLocker(DistributedLocker locker) {
RedissLockUtil.redissLock = locker; RedissLockUtil.redissLock = locker;
...@@ -21,6 +21,7 @@ public class RedissLockUtil { ...@@ -21,6 +21,7 @@ public class RedissLockUtil {
redissLock.unlock(lockKey); redissLock.unlock(lockKey);
} }
/** /**
* 带超时的锁 * 带超时的锁
* @param lockKey * @param lockKey
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment