动态线程池-引入

This commit is contained in:
2023-05-16 18:33:53 +08:00
parent 904be66730
commit 8cbda5870e
37 changed files with 145 additions and 188 deletions

View File

@@ -39,15 +39,13 @@ import org.springframework.scheduling.TaskScheduler;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.Future;
import java.util.concurrent.*;
import java.util.stream.Collectors;
@Slf4j
@@ -70,8 +68,8 @@ public class MyApiService {
private ActValentineCpService actValentineCpService;
@Autowired
private HeadwearService headwearService;
@Autowired
private Executor bizExecutor;
@Resource(name = "bizExecutor")
private ThreadPoolExecutor bizExecutor;
@Autowired
private TaskScheduler taskScheduler;
@Autowired

View File

@@ -28,6 +28,7 @@ import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
@Service
@@ -42,7 +43,7 @@ public class SkillCardAuidoAdminService extends BaseService {
@Autowired
private SendSysMsgService sendSysMsgService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
/**
* 声音秀审核通过 {时间} {通过内容}

View File

@@ -48,6 +48,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
/**
@@ -82,7 +83,7 @@ public class DynamicDataAdminService extends BaseService {
private CommunityDynamicTopicMapMapper communityDynamicTopicMapMapper;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
public HSSFWorkbook buildPushRecordExcel(List<Dynamic> dynamics) {
List<DynamicVerifyVo> dynamicVerifyVos = dynamics.stream().map(dynamic -> dynamicVerifyAdminService.convertVo(dynamic)).collect(Collectors.toList());

View File

@@ -44,6 +44,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
/**
@@ -73,7 +74,7 @@ public class DynamicVerifyAdminService extends BaseService {
private ApplicationContext applicationContext;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
@Autowired
private DynamicSquareService dynamicSquareService;

View File

@@ -41,6 +41,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
/**
* Created by PaperCut on 2018/1/20.
@@ -54,7 +55,7 @@ public class AppVersionAdminController extends BaseController {
@Autowired
private QinniuService qiuniuService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
@Autowired
private AdminUserService adminUserService;
@Autowired

View File

@@ -10,8 +10,8 @@ spring:
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
---
spring:
profiles: dev
@@ -22,8 +22,8 @@ spring:
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
jpa:
show-sql: true
---
@@ -36,5 +36,5 @@ spring:
namespace: 977fb3bc-f5b2-43d7-b9eb-36747405f755
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml

View File

@@ -10,8 +10,8 @@ spring:
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
---
spring:
profiles: dev
@@ -22,8 +22,8 @@ spring:
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
---
spring:
profiles: prod
@@ -34,5 +34,5 @@ spring:
namespace: 977fb3bc-f5b2-43d7-b9eb-36747405f755
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml

View File

@@ -1,131 +1,65 @@
package com.accompany.business.config;
import com.accompany.common.constant.Constant;
import com.accompany.common.utils.StringUtils;
import cn.hippo4j.core.enable.EnableDynamicThreadPool;
import cn.hippo4j.core.executor.DynamicThreadPool;
import cn.hippo4j.core.executor.support.ThreadPoolBuilder;
import cn.hippo4j.core.toolkit.ExecutorTraceContextUtil;
import com.accompany.common.utils.UUIDUitl;
import com.accompany.core.util.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.slf4j.MDC;
import org.springframework.aop.interceptor.AsyncExecutionAspectSupport;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.task.TaskDecorator;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.util.concurrent.ListenableFuture;
import java.util.UUID;
import java.util.concurrent.*;
import java.util.concurrent.ThreadPoolExecutor;
@EnableDynamicThreadPool
@EnableAsync
@Configuration
public class ExecutorConfig {
@Bean
public Executor bizExecutor() {
ThreadPoolTaskExecutor executor = newThreadPoolTaskExecutor();
//配置核心线程数
executor.setCorePoolSize(10);
//配置最大线程数
executor.setMaxPoolSize(100);
//配置队列大小
executor.setQueueCapacity(1000);
executor.setKeepAliveSeconds(120000);
// rejection-policy当pool已经达到max size的时候如何处理新任务
// CALLER_RUNS不在新线程中执行任务而是有调用者所在的线程来执行
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
//用来设置线程池关闭的时候等待所有任务都完成再继续销毁其他的Bean这样这些异步任务的销毁就会先于Redis线程池的销毁。
executor.setWaitForTasksToCompleteOnShutdown(true);
//该方法用来设置线程池中任务的等待时间,如果超过这个时候还没有销毁就强制销毁,以确保应用最后能够被关闭,而不是阻塞住。
executor.setAwaitTerminationSeconds(20);
return executor;
}
private void doRun(Runnable task, String traceId) {
// 异步任务运行前,看父线程是否已经设置了traceId,如果有,则设置成与父线程一致, 如果没有,则设置新的
if (StringUtils.isNotBlank(traceId)) {
MDC.put(Constant.LOG_TRACE_ID_NAME, traceId);
} else {
MDC.put(Constant.LOG_TRACE_ID_NAME, UUID.randomUUID().toString());
}
task.run();
}
private <T> Callable<T> newCallable(Callable<T> task, String traceId) {
return () -> {
// 异步任务运行前,看父线程是否已经设置了traceId,如果有,则设置成与父线程一致, 如果没有,则设置新的
if (StringUtils.isNotBlank(traceId)) {
MDC.put(Constant.LOG_TRACE_ID_NAME, traceId);
} else {
MDC.put(Constant.LOG_TRACE_ID_NAME, UUID.randomUUID().toString());
}
return task.call();
};
}
@NotNull
private ThreadPoolTaskExecutor newThreadPoolTaskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor() {
@Override
public void execute(Runnable task) {
final String traceId = MDC.get(Constant.LOG_TRACE_ID_NAME);
super.execute(() -> {
doRun(task, traceId);
});
}
@Override
public void execute(Runnable task, long startTimeout) {
final String traceId = MDC.get(Constant.LOG_TRACE_ID_NAME);
super.execute(() -> {
doRun(task, traceId);
}, startTimeout);
}
@Override
public <T> Future<T> submit(Callable<T> task) {
final String traceId = MDC.get(Constant.LOG_TRACE_ID_NAME);
return super.submit(newCallable(task, traceId));
}
@Override
public ListenableFuture<?> submitListenable(Runnable task) {
final String traceId = MDC.get(Constant.LOG_TRACE_ID_NAME);
return super.submitListenable(() -> {
doRun(task, traceId);
});
}
@Override
public <T> ListenableFuture<T> submitListenable(Callable<T> task) {
final String traceId = MDC.get(Constant.LOG_TRACE_ID_NAME);
return super.submitListenable(newCallable(task, traceId));
}
};
return executor;
@Primary
@DynamicThreadPool
public ThreadPoolExecutor bizExecutor() {
String threadPoolId = "biz-executor";
return ThreadPoolBuilder.builder()
.threadFactory(threadPoolId)
.threadPoolId(threadPoolId)
.taskDecorator(new TimeoutTraceTaskDecorator())
.dynamicPool()
.build();
}
/**
* 全局默认线程池,直接使用@Async注解的会用到
* @return
*/
@Bean(value = AsyncExecutionAspectSupport.DEFAULT_TASK_EXECUTOR_BEAN_NAME)
public Executor taskExecutor() {
ThreadPoolTaskExecutor executor = newThreadPoolTaskExecutor();
// 配置核心线程数
executor.setCorePoolSize(10);
// 配置最大线程数
executor.setMaxPoolSize(100);
// 配置队列大小
executor.setQueueCapacity(1000);
// 活跃时间
executor.setKeepAliveSeconds(3600 * 24);
// 线程名字前缀
executor.setThreadNamePrefix("default-Async-taskExecutor-");
// 线程用完的时候直接在调用方所在线程执行
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
//用来设置线程池关闭的时候等待所有任务都完成再继续销毁其他的Bean这样这些异步任务的销毁就会先于Redis线程池的销毁。
executor.setWaitForTasksToCompleteOnShutdown(true);
//该方法用来设置线程池中任务的等待时间,如果超过这个时候还没有销毁就强制销毁,以确保应用最后能够被关闭,而不是阻塞住。
executor.setAwaitTerminationSeconds(20);
return executor;
@DynamicThreadPool
public ThreadPoolExecutor asyncExecutor() {
String threadPoolId = "async-executor";
return ThreadPoolBuilder.builder()
.threadFactory(threadPoolId)
.threadPoolId(threadPoolId)
.taskDecorator(new TimeoutTraceTaskDecorator())
.dynamicPool()
.build();
}
public static class TimeoutTraceTaskDecorator implements TaskDecorator {
@NotNull
@Override
public Runnable decorate(@NotNull Runnable runnable) {
String executeTimeoutTrace = ExecutorTraceContextUtil.getAndRemoveTimeoutTrace();
String traceId = StringUtils.isBlank(executeTimeoutTrace)? UUIDUitl.get(): executeTimeoutTrace;
return () -> {
ExecutorTraceContextUtil.putTimeoutTrace(traceId);
runnable.run();
};
}
}
}

View File

@@ -46,6 +46,7 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
@@ -79,7 +80,7 @@ public class MasterApprenticeService extends BaseService {
private ApplicationContext applicationContext;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
public final static String MASTER_GIFT_ID = "master_gift_id";
public final static String APPRENTICE_GIFT_ID = "apprentice_gift_id";

View File

@@ -11,12 +11,12 @@ import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;
/**
@@ -31,7 +31,7 @@ public class SendChatRoomMsgService {
@Autowired
private RoomQueryService roomQueryService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
private static int defMsgType=100;
private Integer BATCH_SIZE = 500;
private Gson gson=new Gson();

View File

@@ -15,6 +15,7 @@ import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.concurrent.ThreadPoolExecutor;
/**
* Created By LeeNana on 2020/2/19.
@@ -26,7 +27,7 @@ public class ActivitiesTurnTableMsgService extends BaseService {
@Autowired
private ErBanNetEaseService erBanNetEaseService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
/**
* 下发暴走状态到客户端

View File

@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ThreadPoolExecutor;
/**
* Created by yanpengcheng on 2019/1/22
@@ -43,7 +44,7 @@ public class ActRedPacketRemindService {
@Autowired
ActivityConfigService activityConfigService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
public static final String REMIND_TIMES_BEGIN_FORMAT = "别离开轻寻首页,精彩继续,红包雨即刻到来";
public static final String REMIND_END_FORMAT = "本年红包雨即刻已经全部发放完毕,小秘书祝大家新年快乐、财源滚滚";

View File

@@ -72,6 +72,7 @@ import java.io.InputStream;
import java.text.ParseException;
import java.util.List;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
@@ -131,7 +132,7 @@ public class AnchorFansTeamServiceImpl extends ServiceImpl<AnchorFansTeamMapper,
@Autowired
private GiftSendService giftSendService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
@Override

View File

@@ -43,6 +43,7 @@ import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.Callable;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
/**
@@ -63,7 +64,7 @@ public class BoxPrizeMessageService {
@Autowired
UsersService usersService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
@Autowired
JedisService jedisService;
@Autowired

View File

@@ -28,6 +28,7 @@ import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ThreadPoolExecutor;
/**
* 话题消息发送
@@ -40,7 +41,7 @@ public class CommunityMessageService extends BaseService {
@Autowired
private SendSysMsgService sendSysMsgService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
@Autowired
private UsersService usersService;

View File

@@ -34,6 +34,7 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
/**
* {这里添加描述}
@@ -59,7 +60,7 @@ public class DynamicCommentService extends CommunityBaseService {
@Autowired
private SysConfService sysConfService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
/**
* 发布一条评论并返回记录id

View File

@@ -72,6 +72,7 @@ import org.springframework.util.StopWatch;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -122,7 +123,7 @@ public class DynamicService extends CommunityBaseService {
@Autowired
private ApplicationContext applicationContext;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
@Autowired

View File

@@ -47,6 +47,7 @@ import org.springframework.util.StopWatch;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -71,7 +72,7 @@ public class DynamicSquareService extends CommunityBaseService {
@Autowired
private IWorldService iWorldService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
@Autowired
private UserBlackRecordService userBlackRecordService;

View File

@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
/**
* Created By LeeNana on 2019/11/13.
@@ -53,7 +54,7 @@ public class InteractiveService extends CommunityBaseService {
@Autowired
private DfaService dfaService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;

View File

@@ -37,6 +37,7 @@ import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -64,7 +65,7 @@ public class FirstPageService extends BaseService {
@Autowired
private UserInRoomService userInRoomService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
public List<FirstPageUserVo> buildFirstPageUserVosWithDistance(List<FirstPageRecommendRoom> recommendRoomList, List<GeoResult<UserOnline>> userOnlineGeoList, UserExpand myUserExpand) throws Exception {

View File

@@ -39,6 +39,7 @@ import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
/**
@@ -71,7 +72,7 @@ public class GiftCompoundService {
RoomService roomService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
@Autowired
ErBanNetEaseService erBanNetEaseService;

View File

@@ -41,6 +41,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
/**
@@ -61,7 +62,7 @@ public class LinearlyPoolPrizeMessageService {
@Autowired
UsersService usersService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
@Autowired
JedisService jedisService;
@Autowired

View File

@@ -1,26 +1,21 @@
package com.accompany.business.service.rank;
import com.accompany.business.model.room.SingleBroadcastPopularity;
import com.accompany.business.service.ErBanNetEaseService;
import com.accompany.business.service.room.RoomRankService;
import com.accompany.business.service.room.RoomService;
import com.accompany.business.service.user.UsersService;
import com.accompany.common.constant.Attach;
import com.accompany.common.constant.Constant;
import com.accompany.common.utils.DateTimeUtil;
import com.accompany.common.utils.UUIDUitl;
import com.accompany.core.model.Room;
import com.accompany.core.model.Users;
import com.accompany.core.service.common.JedisService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -28,6 +23,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
@Service
@@ -37,14 +33,12 @@ public class PermitRoomTaskService {
private JedisService jedisService;
@Autowired
private RoomRankService roomRankService;
@Autowired
private UsersService usersService;
@Autowired
private RoomService roomService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
@Autowired
private ErBanNetEaseService erBanNetEaseService;

View File

@@ -34,9 +34,11 @@ import org.springframework.scheduling.support.CronSequenceGenerator;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@Slf4j
@@ -56,8 +58,8 @@ public class RoomFreeGiftService implements InitializingBean, ApplicationListene
private UserBackpackService userBackpackService;
@Autowired
private RoomQueryService roomQueryService;
@Autowired
private TaskExecutor bizExecutor;
@Resource(name = "bizExecutor")
private ThreadPoolExecutor bizExecutor;
@Autowired
private ErBanNetEaseService erBanNetEaseService;

View File

@@ -29,7 +29,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -37,6 +36,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
/**
@@ -59,7 +59,7 @@ public class SingleRoomTaskService {
@Autowired
private SingleBroadcastPopularityService singleBroadcastPopularityService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
@Autowired
private ErBanNetEaseService erBanNetEaseService;

View File

@@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
/**
* {这里添加描述}
@@ -36,7 +37,7 @@ public class TopicBoxMsgService extends BaseService {
@Autowired
private TopicBoxMsgMapper topicBoxMsgMapper;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
/** 话匣子消息标识 */
private final String FIELD_CAN_SEND_FLAG = "canSendFlag";

View File

@@ -38,6 +38,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;
/**
* <br>类描述:
@@ -63,7 +64,7 @@ public class VipMessageService {
@Autowired
private RoomQueryService roomQueryService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
/**
* 开通贵族小秘书消息

View File

@@ -33,6 +33,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;
/**
* <br>类描述:
@@ -55,7 +56,7 @@ public class VipTaskService {
@Autowired
private VipLevelBizService vipLevelBizService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
private final static Integer max_retry_time = 10;

View File

@@ -45,6 +45,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
@@ -81,7 +82,7 @@ public class WorldGroupChatService extends BaseService {
private WorldGroupChatTopicService worldGroupChatTopicService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
@Autowired
private SendSysMsgService sendSysMsgService;

View File

@@ -33,6 +33,7 @@ import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ThreadPoolExecutor;
;
@@ -48,7 +49,7 @@ public class WorldMessageService extends BaseService {
private SendSysMsgService sendSysMsgService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
@Autowired
private RoomService roomService;

View File

@@ -41,6 +41,7 @@ import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
/**
@@ -58,7 +59,7 @@ public class WorldRoomService extends BaseService {
private WorldGroupChatService worldGroupChatService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
@Autowired
private RoomService roomService;

View File

@@ -36,6 +36,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
/**
@@ -74,7 +75,7 @@ public class WorldService extends BaseService {
@Autowired
private IWorldPreCleanRecordService iWorldPreCleanRecordService;
@Resource(name = "bizExecutor")
private TaskExecutor bizExecutor;
private ThreadPoolExecutor bizExecutor;
/**
* 话题首页

View File

@@ -10,8 +10,8 @@ spring:
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
---
spring:
profiles: dev
@@ -22,8 +22,8 @@ spring:
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
---
spring:
profiles: prod
@@ -34,5 +34,5 @@ spring:
namespace: 977fb3bc-f5b2-43d7-b9eb-36747405f755
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml

View File

@@ -10,8 +10,8 @@ spring:
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,oauth2-dev.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,oauth2-dev.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
---
spring:
profiles: dev
@@ -22,8 +22,8 @@ spring:
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
---
spring:
profiles: prod
@@ -34,5 +34,5 @@ spring:
namespace: 977fb3bc-f5b2-43d7-b9eb-36747405f755
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml

View File

@@ -10,8 +10,8 @@ spring:
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
---
spring:
profiles: dev
@@ -22,8 +22,8 @@ spring:
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
---
spring:
profiles: prod
@@ -34,5 +34,5 @@ spring:
namespace: 977fb3bc-f5b2-43d7-b9eb-36747405f755
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml

View File

@@ -960,6 +960,11 @@
<version>${rocketmq-spring-boot-starter.version}</version>
</dependency>
<dependency>
<groupId>cn.hippo4j</groupId>
<artifactId>hippo4j-config-spring-boot-starter</artifactId>
<version>1.5.0</version>
</dependency>
</dependencies>

View File

@@ -10,8 +10,8 @@ spring:
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
---
spring:
profiles: dev
@@ -22,8 +22,8 @@ spring:
namespace: 5edc3246-3e69-4be5-a32a-273f0a09ddf6
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
---
spring:
profiles: prod
@@ -34,5 +34,5 @@ spring:
namespace: 977fb3bc-f5b2-43d7-b9eb-36747405f755
name: ${spring.application.name}
file-extension: yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,database.yml,sysconf.yml
shared-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml
refreshable-dataids: application.yml,thirdpart.yml,pay.yml,sysconf.yml,threadpool.yml