🎨 代码优化

This commit is contained in:
ronger 2022-12-09 10:13:21 +08:00
parent a2aad3e827
commit 03185a5a63
5 changed files with 8 additions and 40 deletions

View File

@ -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,

View File

@ -21,7 +21,7 @@ public class GlobalResult<T> {
}
public static <T> GlobalResult<T> newInstance() {
return new GlobalResult();
return new GlobalResult<>();
}
}

View File

@ -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通配符仅支持*

View File

@ -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;
}

View File

@ -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);
}
}
}