From 03185a5a63ff1f1a0e29f6e73c96133d4aa512ba Mon Sep 17 00:00:00 2001 From: ronger Date: Fri, 9 Dec 2022 10:13:21 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VisitableThreadPoolTaskExecutor.java | 3 +- .../forest/core/result/GlobalResult.java | 2 +- .../core/service/redis/RedisService.java | 6 ++-- .../service/redis/impl/RedisServiceImpl.java | 6 ++-- .../com/rymcu/forest/task/BaiDuCronTask.java | 31 ------------------- 5 files changed, 8 insertions(+), 40 deletions(-) delete mode 100644 src/main/java/com/rymcu/forest/task/BaiDuCronTask.java diff --git a/src/main/java/com/rymcu/forest/config/VisitableThreadPoolTaskExecutor.java b/src/main/java/com/rymcu/forest/config/VisitableThreadPoolTaskExecutor.java index 8e47aea..bc12f9a 100644 --- a/src/main/java/com/rymcu/forest/config/VisitableThreadPoolTaskExecutor.java +++ b/src/main/java/com/rymcu/forest/config/VisitableThreadPoolTaskExecutor.java @@ -19,9 +19,8 @@ import java.util.concurrent.ThreadPoolExecutor; public class VisitableThreadPoolTaskExecutor extends ThreadPoolTaskExecutor { private static final Logger logger = LoggerFactory.getLogger(VisitableThreadPoolTaskExecutor.class); - private void showThreadPoolInfo(String prefix){ + private void showThreadPoolInfo(String prefix) { ThreadPoolExecutor threadPoolExecutor = getThreadPoolExecutor(); - logger.info("{}, {},taskCount [{}], completedTaskCount [{}], activeCount [{}], queueSize [{}]", this.getThreadNamePrefix(), prefix, diff --git a/src/main/java/com/rymcu/forest/core/result/GlobalResult.java b/src/main/java/com/rymcu/forest/core/result/GlobalResult.java index 2e52f6f..faab103 100644 --- a/src/main/java/com/rymcu/forest/core/result/GlobalResult.java +++ b/src/main/java/com/rymcu/forest/core/result/GlobalResult.java @@ -21,7 +21,7 @@ public class GlobalResult { } public static GlobalResult newInstance() { - return new GlobalResult(); + return new GlobalResult<>(); } } diff --git a/src/main/java/com/rymcu/forest/core/service/redis/RedisService.java b/src/main/java/com/rymcu/forest/core/service/redis/RedisService.java index c005437..e5f64bf 100644 --- a/src/main/java/com/rymcu/forest/core/service/redis/RedisService.java +++ b/src/main/java/com/rymcu/forest/core/service/redis/RedisService.java @@ -134,7 +134,7 @@ public interface RedisService { * @param expireTime 缓存内容过期时间 (单位:秒) ,若expireTime小于0 则表示该内容不过期 * @return */ - String set(String key, Object obj, int expireTime); + String set(String key, Object obj, long expireTime); /** @@ -145,7 +145,7 @@ public interface RedisService { * @param expireTime 缓存内容过期时间 (单位:秒) ,若expireTime小于0 则表示该内容不过期 * @return */ - String set(String key, String value, int expireTime); + String set(String key, String value, long expireTime); /** * 写入/修改 缓存内容 @@ -212,7 +212,7 @@ public interface RedisService { * @param key * @param seconds */ - void setTTL(String key, int seconds); + void setTTL(String key, long seconds); /** * 根据通配符表达式查询key值的set,通配符仅支持* diff --git a/src/main/java/com/rymcu/forest/core/service/redis/impl/RedisServiceImpl.java b/src/main/java/com/rymcu/forest/core/service/redis/impl/RedisServiceImpl.java index 6c36f11..7cacb08 100644 --- a/src/main/java/com/rymcu/forest/core/service/redis/impl/RedisServiceImpl.java +++ b/src/main/java/com/rymcu/forest/core/service/redis/impl/RedisServiceImpl.java @@ -163,7 +163,7 @@ public class RedisServiceImpl implements RedisService { * @return */ @Override - public String set(String key, Object obj, int expireTime) { + public String set(String key, Object obj, long expireTime) { String value = RedisService.BLANK_CONTENT; if (obj != null) { try { @@ -184,7 +184,7 @@ public class RedisServiceImpl implements RedisService { * @return */ @Override - public String set(String key, String value, int expireTime) { + public String set(String key, String value, long expireTime) { if (StringUtils.isBlank(key)) { logger.warn("Params key is blank!"); return null; @@ -460,7 +460,7 @@ public class RedisServiceImpl implements RedisService { * @param seconds */ @Override - public void setTTL(String key, int seconds) { + public void setTTL(String key, long seconds) { if (seconds < 0) { return; } diff --git a/src/main/java/com/rymcu/forest/task/BaiDuCronTask.java b/src/main/java/com/rymcu/forest/task/BaiDuCronTask.java deleted file mode 100644 index ce7127f..0000000 --- a/src/main/java/com/rymcu/forest/task/BaiDuCronTask.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.rymcu.forest.task; - -import com.rymcu.forest.core.constant.ProjectConstant; -import com.rymcu.forest.util.BaiDuUtils; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.Scheduled; - -/** - * @author ronger - */ -//@Component -@Slf4j -public class BaiDuCronTask { - - @Value("${resource.domain}") - private String domain; - @Value(("${env}")) - private String env; - - /** - * 定时推送首页更新 - */ - @Scheduled(cron = "0 0 10,14,18 * * ?") - public void pushHome() { - if (!ProjectConstant.ENV.equals(env)) { - BaiDuUtils.sendUpdateSEOData(domain); - } - } - -}