dtp-引入dtp代替hippop4j

This commit is contained in:
2025-08-27 16:43:26 +08:00
parent 99922e8630
commit d8a5f54f03
56 changed files with 121 additions and 170 deletions

View File

@@ -96,7 +96,7 @@ public class MyApiService {
private RoomReciveRankingService roomReciveRankingService; private RoomReciveRankingService roomReciveRankingService;
@Autowired @Autowired
private RoomSendRankingService roomSendRankingService; private RoomSendRankingService roomSendRankingService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Autowired @Autowired
private UsersService usersService; private UsersService usersService;

View File

@@ -68,7 +68,7 @@ public class BravoPoolAdminService {
@Autowired @Autowired
private BravoUserMetaService userMetaService; private BravoUserMetaService userMetaService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
private String minStartDate = "2025-03-20"; private String minStartDate = "2025-03-20";

View File

@@ -62,7 +62,7 @@ public class Lucky24RecordAdminService {
@Autowired @Autowired
private Lucky24RecordMapper recordMapper; private Lucky24RecordMapper recordMapper;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
private String minStartDate = "2024-09-20"; private String minStartDate = "2024-09-20";

View File

@@ -53,7 +53,7 @@ public class Lucky25RecordAdminService {
@Autowired @Autowired
private Lucky25RecordMapper recordMapper; private Lucky25RecordMapper recordMapper;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
private String minStartDate = "2025-05-04"; private String minStartDate = "2025-05-04";

View File

@@ -42,7 +42,7 @@ public class RechargeRiskUserAdminService {
private AccountBlockService accountBlockService; private AccountBlockService accountBlockService;
@Autowired @Autowired
private RechargeRiskUserAdminMapper rechargeRiskUserAdminMapper; private RechargeRiskUserAdminMapper rechargeRiskUserAdminMapper;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
public Page<RechargeRiskUserAdminVo> page(Long erbanNo, PageReq req) { public Page<RechargeRiskUserAdminVo> page(Long erbanNo, PageReq req) {

View File

@@ -77,7 +77,7 @@ public class DynamicDataAdminService extends BaseService {
@Autowired @Autowired
private IWorldService iWorldService; private IWorldService iWorldService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
public HSSFWorkbook buildPushRecordExcel(List<Dynamic> dynamics) { public HSSFWorkbook buildPushRecordExcel(List<Dynamic> dynamics) {

View File

@@ -1,6 +1,7 @@
package com.accompany.admin; package com.accompany.admin;
import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.MeterRegistry;
import org.dromara.dynamictp.spring.annotation.EnableDynamicTp;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.SpringBootConfiguration;
@@ -16,6 +17,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
* admin * admin
* *
*/ */
@EnableDynamicTp
@SpringBootApplication @SpringBootApplication
@ComponentScan({"com.accompany","com.xuanyin"}) @ComponentScan({"com.accompany","com.xuanyin"})
@EnableScheduling @EnableScheduling

View File

@@ -49,7 +49,7 @@ public class AppVersionAdminController extends BaseController {
private AppVersionAdminService appVersionAdminService; private AppVersionAdminService appVersionAdminService;
@Autowired @Autowired
private TencentCosUploadService uploadService; private TencentCosUploadService uploadService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Autowired @Autowired
private AdminUserService adminUserService; private AdminUserService adminUserService;

View File

@@ -30,7 +30,7 @@ spring:
refresh: true refresh: true
- data-id: sysconf.yml - data-id: sysconf.yml
refresh: true refresh: true
- data-id: threadpool.yml - data-id: dtp.yml
refresh: true refresh: true
--- ---
@@ -53,7 +53,7 @@ spring:
refresh: true refresh: true
- data-id: sysconf.yml - data-id: sysconf.yml
refresh: true refresh: true
- data-id: threadpool.yml - data-id: dtp.yml
refresh: true refresh: true
- data-id: database.yml - data-id: database.yml
refresh: true refresh: true

View File

@@ -1,5 +1,6 @@
package com.accompany.flowteam.admin; package com.accompany.flowteam.admin;
import org.dromara.dynamictp.spring.annotation.EnableDynamicTp;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.SpringBootConfiguration;
@@ -13,6 +14,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
* admin * admin
* *
*/ */
@EnableDynamicTp
@SpringBootApplication @SpringBootApplication
@ComponentScan({"com.accompany","com.xuanyin"}) @ComponentScan({"com.accompany","com.xuanyin"})
@EnableScheduling @EnableScheduling

View File

@@ -30,7 +30,7 @@ spring:
refresh: true refresh: true
- data-id: sysconf.yml - data-id: sysconf.yml
refresh: true refresh: true
- data-id: threadpool.yml - data-id: dtp.yml
refresh: true refresh: true
--- ---
@@ -53,7 +53,7 @@ spring:
refresh: true refresh: true
- data-id: sysconf.yml - data-id: sysconf.yml
refresh: true refresh: true
- data-id: threadpool.yml - data-id: dtp.yml
refresh: true refresh: true
- data-id: database.yml - data-id: database.yml
refresh: true refresh: true

View File

@@ -90,6 +90,24 @@
<version>${rocketmq-spring-boot.version}</version> <version>${rocketmq-spring-boot.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.dromara.dynamictp</groupId>
<artifactId>dynamic-tp-spring-boot-starter-nacos</artifactId>
<version>${dynamic-tp.version}</version>
</dependency>
<dependency>
<groupId>org.dromara.dynamictp</groupId>
<artifactId>dynamic-tp-spring-boot-starter-adapter-webserver</artifactId>
<version>${dynamic-tp.version}</version>
</dependency>
<dependency>
<groupId>org.dromara.dynamictp</groupId>
<artifactId>dynamic-tp-spring-boot-starter-adapter-rocketmq</artifactId>
<version>${dynamic-tp.version}</version>
</dependency>
</dependencies> </dependencies>

View File

@@ -0,0 +1,28 @@
package com.accompany.common.config;
import com.accompany.core.base.SpringContextHolder;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import java.util.concurrent.Executor;
@Slf4j
@EnableAsync
@Configuration
public class ExecutorConfig implements AsyncConfigurer {
@Override
public Executor getAsyncExecutor() {
return SpringContextHolder.getBean("async-executor");
}
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return (ex,method,params)->log.error("@Async 执行异步方法{} 错误,参数{}", method, JSON.toJSONString(params), ex);
}
}

View File

@@ -1,108 +0,0 @@
package com.accompany.business.config;
import com.accompany.common.aop.ApiRequestLogAspect;
import com.accompany.core.base.SpringContextHolder;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.MDC;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
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.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import javax.validation.constraints.NotNull;
import java.util.UUID;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
@Slf4j
@EnableAsync
@Configuration
public class ExecutorConfig implements AsyncConfigurer {
@Bean
@Primary
public ThreadPoolExecutor bizExecutor() {
String threadPoolId = "biz-executor";
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
// 核心线程数
executor.setCorePoolSize(5);
// 最大线程数
executor.setMaxPoolSize(10);
// 队列容量
executor.setQueueCapacity(100);
// 线程空闲时间(秒)
executor.setKeepAliveSeconds(60);
// 线程名称前缀
executor.setThreadNamePrefix(threadPoolId);
executor.setTaskDecorator(new MDCDecorator());
// 设置拒绝策略
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
// 初始化
executor.initialize();
return executor.getThreadPoolExecutor();
}
@Bean("async-executor")
public ThreadPoolExecutor asyncExecutor() {
String threadPoolId = "async-executor";
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
// 核心线程数
executor.setCorePoolSize(5);
// 最大线程数
executor.setMaxPoolSize(10);
// 队列容量
executor.setQueueCapacity(100);
// 线程空闲时间(秒)
executor.setKeepAliveSeconds(60);
// 线程名称前缀
executor.setThreadNamePrefix(threadPoolId);
executor.setTaskDecorator(new MDCDecorator());
// 设置拒绝策略
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
// 初始化
executor.initialize();
return executor.getThreadPoolExecutor();
}
public static class MDCDecorator implements TaskDecorator {
@NotNull
@Override
public Runnable decorate(@NotNull Runnable runnable) {
String mainThreadTraceId = MDC.get(ApiRequestLogAspect.TRACE_UUID);
String traceId = !StringUtils.isBlank(mainThreadTraceId)?
mainThreadTraceId :
UUID.randomUUID().toString();
return () -> {
try {
// Right now: @Async thread context !
// Restore the Web thread context's MDC data
MDC.put(ApiRequestLogAspect.TRACE_UUID, traceId);
runnable.run();
} finally {
MDC.remove(ApiRequestLogAspect.TRACE_UUID);
}
};
}
}
@Override
public Executor getAsyncExecutor() {
return SpringContextHolder.getBean("async-executor");
}
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return (ex,method,params)->log.error("@Async 执行异步方法{} 错误,参数{}", method, JSON.toJSONString(params), ex);
}
}

View File

@@ -44,7 +44,7 @@ public class WeekGuildOperatorStatService {
private WeekGuildOperatorDetailStatMapper detailStatMapper; private WeekGuildOperatorDetailStatMapper detailStatMapper;
@Autowired @Autowired
private GuildService guildService; private GuildService guildService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Autowired @Autowired
private UsersService usersService; private UsersService usersService;

View File

@@ -36,7 +36,7 @@ public class WeekGuildPartitionStatService {
private GuildService guildService; private GuildService guildService;
@Autowired @Autowired
private GuildMemberService guildMemberService; private GuildMemberService guildMemberService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
public void stat(Integer partitionId, String mondayStr) { public void stat(Integer partitionId, String mondayStr) {

View File

@@ -34,7 +34,7 @@ public class WeekRechargeAgentPartitionStatService {
@Autowired @Autowired
private WeekRechargeAgentPartitionStatMapper mapper; private WeekRechargeAgentPartitionStatMapper mapper;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Autowired @Autowired
private GuildUsdBillRecordMapper guildUsdBillRecordMapper; private GuildUsdBillRecordMapper guildUsdBillRecordMapper;

View File

@@ -27,6 +27,7 @@ import com.google.gson.Gson;
import jodd.util.StringUtil; import jodd.util.StringUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
@@ -48,6 +49,7 @@ public class AccountBlockService extends ServiceImpl<AccountBlockMapper, Account
@Autowired @Autowired
private UsersBaseService usersBaseService; private UsersBaseService usersBaseService;
@Autowired @Autowired
@Lazy
private RoomService roomService; private RoomService roomService;
@Autowired @Autowired
private JedisService jedisService; private JedisService jedisService;

View File

@@ -37,9 +37,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -74,10 +76,8 @@ public class ActivitiesLuckySeaServiceImpl implements ActivitiesLuckySeaService
private LuckySeaUserDrawResultService userDrawResultService; private LuckySeaUserDrawResultService userDrawResultService;
@Autowired @Autowired
private LuckySeaUserDrawRecordService userDrawRecordService; private LuckySeaUserDrawRecordService userDrawRecordService;
@Autowired @Resource(name = "biz-executor")
private Executor taskExecutor; private ThreadPoolExecutor taskExecutor;
@Autowired
private LuckySeaStockService stockService;
@Override @Override
public void updateUserLuckySeaActPiece(Long uid, Integer packId, Integer packNum) { public void updateUserLuckySeaActPiece(Long uid, Integer packId, Integer packNum) {

View File

@@ -28,9 +28,11 @@ import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -60,8 +62,8 @@ public class ActivityPackMessageService {
private UserActPropertyInfoV2Service userActPropertyInfoV2Service; private UserActPropertyInfoV2Service userActPropertyInfoV2Service;
@Autowired @Autowired
private ActivitiesDrawService activitiesDrawService; private ActivitiesDrawService activitiesDrawService;
@Autowired @Resource(name = "biz-executor")
private Executor bizExecutor; private ThreadPoolExecutor bizExecutor;
private Gson gson = new Gson(); private Gson gson = new Gson();

View File

@@ -49,9 +49,11 @@ import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -87,8 +89,8 @@ public class ClanServiceImpl extends ServiceImpl<ClanMapper, Clan> implements Cl
@Autowired @Autowired
private ClanRankService clanRankService; private ClanRankService clanRankService;
@Autowired @Resource(name = "biz-executor")
private Executor taskExecutor; private ThreadPoolExecutor taskExecutor;
@Override @Override
public ClanVO getUserClanInfo(Long uid) { public ClanVO getUserClanInfo(Long uid) {

View File

@@ -66,7 +66,7 @@ public class FamilyManagerService {
private PartitionInfoService partitionInfoService; private PartitionInfoService partitionInfoService;
@Autowired @Autowired
private JedisService jedisService; private JedisService jedisService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Autowired @Autowired
private FamilyMemberWeekLevelRewardService familyMemberWeekLevelRewardService; private FamilyMemberWeekLevelRewardService familyMemberWeekLevelRewardService;

View File

@@ -75,7 +75,7 @@ public class AgencyMonthSettleService {
private MessageRobotPushService messageRobotPushService; private MessageRobotPushService messageRobotPushService;
@Autowired @Autowired
private WebSecurityConfig webSecurityConfig; private WebSecurityConfig webSecurityConfig;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Autowired @Autowired
private SendSysMsgService sendSysMsgService; private SendSysMsgService sendSysMsgService;

View File

@@ -75,7 +75,7 @@ public class GuildManagerService {
private PartitionInfoService partitionInfoService; private PartitionInfoService partitionInfoService;
@Autowired @Autowired
private GuildDiamondWageService guildDiamondWageService; private GuildDiamondWageService guildDiamondWageService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Autowired @Autowired
private JedisService jedisService; private JedisService jedisService;

View File

@@ -52,7 +52,7 @@ public class GuildUsdChannelService {
private GuildUsdProdService guildUsdProdService; private GuildUsdProdService guildUsdProdService;
@Autowired @Autowired
private RechargeUserService rechargeUserService; private RechargeUserService rechargeUserService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Autowired @Autowired
private GuildUsdBillRecordService guildUsdBillRecordService; private GuildUsdBillRecordService guildUsdBillRecordService;

View File

@@ -61,7 +61,7 @@ public class GuildPolicy2Service {
private GuildDiamondClearPolicy2Service guildDiamondClearPolicy2Service; private GuildDiamondClearPolicy2Service guildDiamondClearPolicy2Service;
@Autowired @Autowired
private UserPurseService userPurseService; private UserPurseService userPurseService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Autowired @Autowired
private GuildCrystalSettlementService guildCrystalSettlementService; private GuildCrystalSettlementService guildCrystalSettlementService;

View File

@@ -89,7 +89,7 @@ public class HallManageService extends BaseService {
private OtakuRankService otakuRankService; private OtakuRankService otakuRankService;
@Autowired @Autowired
private JedisService jedisService; private JedisService jedisService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor taskExecutor; private ThreadPoolExecutor taskExecutor;
private static final String shareContent = "【複製后打開 %s APP】\n" + private static final String shareContent = "【複製后打開 %s APP】\n" +

View File

@@ -43,7 +43,7 @@ public class LevelService extends BaseService implements InitializingBean {
private LevelCharmMapper levelCharmMapper; private LevelCharmMapper levelCharmMapper;
@Autowired @Autowired
private UsersService usersService; private UsersService usersService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
private static final ConcurrentHashMap<Integer, LevelExperience> LEVEL_EXPERIENCE_MAP = new ConcurrentHashMap<>(); private static final ConcurrentHashMap<Integer, LevelExperience> LEVEL_EXPERIENCE_MAP = new ConcurrentHashMap<>();

View File

@@ -33,7 +33,7 @@ public class BravoRecordService extends ServiceImpl<BravoRecordMapper, BravoReco
@Autowired @Autowired
private BravoStatMapper statMapper; private BravoStatMapper statMapper;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
public BravoRecord buildRecord(long senderUid, int partitionId, Gift gift, int giftNum, Long roomUid, long receiverUid, public BravoRecord buildRecord(long senderUid, int partitionId, Gift gift, int giftNum, Long roomUid, long receiverUid,

View File

@@ -30,7 +30,7 @@ public class BravoSettlementService {
@Autowired @Autowired
private BravoMsgSendService msgSendService; private BravoMsgSendService msgSendService;
@Async("bizExecutor") @Async("biz-executor")
public void sendReward(BravoGiftConfig config, long senderUid, Room room, public void sendReward(BravoGiftConfig config, long senderUid, Room room,
Gift gift, Map<Long, BravoRecord> recordMap, Gift gift, Map<Long, BravoRecord> recordMap,
BigDecimal winGoldNum, BigDecimal afterMultiple){ BigDecimal winGoldNum, BigDecimal afterMultiple){

View File

@@ -36,7 +36,7 @@ public class Lucky24RecordService extends ServiceImpl<Lucky24RecordMapper, Lucky
@Autowired @Autowired
private Lucky24StatMapper statMapper; private Lucky24StatMapper statMapper;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
public Lucky24Record buildRecord(long senderUid, int partitionId, Gift gift, int giftNum, Long roomUid, long receiverUid, public Lucky24Record buildRecord(long senderUid, int partitionId, Gift gift, int giftNum, Long roomUid, long receiverUid,

View File

@@ -25,7 +25,7 @@ public class Lucky24SettlementService {
@Autowired @Autowired
private SuperLuckyGiftSendService superLuckyGiftSendService; private SuperLuckyGiftSendService superLuckyGiftSendService;
@Async("bizExecutor") @Async("biz-executor")
public void sendReward(Lucky24GiftConfig config, long senderUid, Room room, Gift gift, long winGoldNum, long afterMultiple){ public void sendReward(Lucky24GiftConfig config, long senderUid, Room room, Gift gift, long winGoldNum, long afterMultiple){
// 道具奖励 // 道具奖励
double winGoldNumD = (double) winGoldNum; double winGoldNumD = (double) winGoldNum;

View File

@@ -29,7 +29,7 @@ public class Lucky25RecordService extends ServiceImpl<Lucky25RecordMapper, Lucky
@Autowired @Autowired
private Lucky25StatMapper statMapper; private Lucky25StatMapper statMapper;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
public Lucky25Record buildRecord(long senderUid, int partitionId, Gift gift, int giftNum, Long roomUid, long receiverUid, Integer poolId, public Lucky25Record buildRecord(long senderUid, int partitionId, Gift gift, int giftNum, Long roomUid, long receiverUid, Integer poolId,

View File

@@ -25,7 +25,7 @@ public class Lucky25SettlementService {
@Autowired @Autowired
private SuperLuckyGiftSendService superLuckyGiftSendService; private SuperLuckyGiftSendService superLuckyGiftSendService;
@Async("bizExecutor") @Async("biz-executor")
public void sendReward(Lucky25GiftConfig config, long senderUid, Room room, Gift gift, long winGoldNum, long afterMultiple){ public void sendReward(Lucky25GiftConfig config, long senderUid, Room room, Gift gift, long winGoldNum, long afterMultiple){
// 道具奖励 // 道具奖励
double winGoldNumD = (double) winGoldNum; double winGoldNumD = (double) winGoldNum;

View File

@@ -98,7 +98,7 @@ public class MiniGameForNavServiceImpl implements MiniGameForNavService {
@Autowired @Autowired
private SendSysMsgService sendSysMsgService; private SendSysMsgService sendSysMsgService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Autowired @Autowired

View File

@@ -37,7 +37,7 @@ public class PermitRoomTaskService {
@Autowired @Autowired
private RoomService roomService; private RoomService roomService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Autowired @Autowired
private ErBanNetEaseService erBanNetEaseService; private ErBanNetEaseService erBanNetEaseService;

View File

@@ -60,7 +60,7 @@ public class RoomBackgroundService extends ServiceImpl<RoomBackgroundMapper, Roo
private BillRecordService billRecordService; private BillRecordService billRecordService;
@Autowired @Autowired
private SendSysMsgService sendSysMsgService; private SendSysMsgService sendSysMsgService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor taskExecutor; private ThreadPoolExecutor taskExecutor;
private final long defaultId = 1L; private final long defaultId = 1L;

View File

@@ -37,7 +37,6 @@ import com.accompany.business.service.administrator.SuperAdminWebService;
import com.accompany.business.service.dfa.DfaService; import com.accompany.business.service.dfa.DfaService;
import com.accompany.business.service.follow.FansRoomService; import com.accompany.business.service.follow.FansRoomService;
import com.accompany.business.service.follow.FansService; import com.accompany.business.service.follow.FansService;
import com.accompany.business.service.level.LevelService;
import com.accompany.business.service.miniGame.MiniGameRoomService; import com.accompany.business.service.miniGame.MiniGameRoomService;
import com.accompany.business.service.miniGame.MiniGameService; import com.accompany.business.service.miniGame.MiniGameService;
import com.accompany.business.service.miniGame.MiniGameSwitchRecordService; import com.accompany.business.service.miniGame.MiniGameSwitchRecordService;
@@ -79,7 +78,6 @@ import com.accompany.core.service.region.RegionInfoService;
import com.accompany.core.util.BeanUtils; import com.accompany.core.util.BeanUtils;
import com.accompany.core.util.I18NMessageSourceUtil; import com.accompany.core.util.I18NMessageSourceUtil;
import com.accompany.core.util.PartitionUtil; import com.accompany.core.util.PartitionUtil;
import com.accompany.core.vo.UserVo;
import com.accompany.sharding.mapper.GiftSendRecordMapperExpand; import com.accompany.sharding.mapper.GiftSendRecordMapperExpand;
import com.accompany.sharding.model.GiftSendRecord; import com.accompany.sharding.model.GiftSendRecord;
import com.accompany.sharding.vo.RoomSerialVo; import com.accompany.sharding.vo.RoomSerialVo;
@@ -102,11 +100,9 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.accompany.business.constant.RoomConstant.RedisKey.*; import static com.accompany.business.constant.RoomConstant.RedisKey.*;
@@ -160,8 +156,6 @@ public class RoomService extends BaseService {
@Lazy @Lazy
private SuperAdminWebService superAdminWebService; private SuperAdminWebService superAdminWebService;
@Autowired @Autowired
private LevelService levelService;
@Autowired
private DfaService dfaService; private DfaService dfaService;
@Autowired @Autowired
private RobotV2Service robotV2Service; private RobotV2Service robotV2Service;

View File

@@ -42,11 +42,13 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static com.accompany.common.constant.Constant.VipAuthType.VISIT_HIDE; import static com.accompany.common.constant.Constant.VipAuthType.VISIT_HIDE;
@@ -77,8 +79,8 @@ public class UserDetailsService extends BaseService {
private RechargeUserService rechargeUserService; private RechargeUserService rechargeUserService;
@Autowired @Autowired
private PartitionInfoService partitionInfoService; private PartitionInfoService partitionInfoService;
@Autowired @Resource(name = "biz-executor")
private Executor taskExecutor; private ThreadPoolExecutor taskExecutor;
@Autowired @Autowired
private UserGamePartnerInfoService userGamePartnerInfoService; private UserGamePartnerInfoService userGamePartnerInfoService;
@Autowired @Autowired

View File

@@ -51,7 +51,7 @@ public class VipTaskService {
private VipLevelBizService vipLevelBizService; private VipLevelBizService vipLevelBizService;
@Autowired @Autowired
private VipReturnProfitRecordService vipReturnProfitRecordService; private VipReturnProfitRecordService vipReturnProfitRecordService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Autowired @Autowired
private UserMedalService userMedalService; private UserMedalService userMedalService;

View File

@@ -94,7 +94,7 @@ public class RewardUtil {
@Autowired @Autowired
private UserGoldBeanService userGoldBeanService; private UserGoldBeanService userGoldBeanService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
public List<RewardVo> sendRewardByUid(Long uid, public List<RewardVo> sendRewardByUid(Long uid,

View File

@@ -1,6 +1,7 @@
package com.accompany.business; package com.accompany.business;
import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.MeterRegistry;
import org.dromara.dynamictp.spring.annotation.EnableDynamicTp;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.SpringBootConfiguration;
@@ -16,6 +17,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer; import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;
@EnableDynamicTp
@SpringBootApplication @SpringBootApplication
@EnableTransactionManagement @EnableTransactionManagement
@EnableAspectJAutoProxy(proxyTargetClass = true) @EnableAspectJAutoProxy(proxyTargetClass = true)

View File

@@ -96,7 +96,7 @@ public class UsersController extends BaseController {
private PrivatePhotoService privatePhotoService; private PrivatePhotoService privatePhotoService;
@Autowired @Autowired
private RoomService roomService; private RoomService roomService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Autowired @Autowired
private AudioCardService audioCardService; private AudioCardService audioCardService;

View File

@@ -30,7 +30,7 @@ spring:
refresh: true refresh: true
- data-id: sysconf.yml - data-id: sysconf.yml
refresh: true refresh: true
- data-id: bussiness-threadpool.yml - data-id: bussiness-dtp.yml
refresh: true refresh: true
--- ---
@@ -53,7 +53,7 @@ spring:
refresh: true refresh: true
- data-id: sysconf.yml - data-id: sysconf.yml
refresh: true refresh: true
- data-id: bussiness-threadpool.yml - data-id: bussiness-dtp.yml
refresh: true refresh: true
- data-id: database.yml - data-id: database.yml
refresh: true refresh: true

View File

@@ -85,6 +85,7 @@
<pinyin4j.version>2.5.1</pinyin4j.version> <pinyin4j.version>2.5.1</pinyin4j.version>
<cloudauth20190307.version>1.0.1</cloudauth20190307.version> <cloudauth20190307.version>1.0.1</cloudauth20190307.version>
<aws.version>2.30.37</aws.version> <aws.version>2.30.37</aws.version>
<dynamic-tp.version>1.2.2</dynamic-tp.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>

View File

@@ -1,5 +1,6 @@
package com.accompany.oauth2; package com.accompany.oauth2;
import org.dromara.dynamictp.spring.annotation.EnableDynamicTp;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.SpringBootConfiguration;
@@ -9,6 +10,7 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
@EnableDynamicTp
@SpringBootApplication @SpringBootApplication
@ComponentScan("com.accompany") @ComponentScan("com.accompany")
@ServletComponentScan(value = {"com.accompany", "com.xuanyin"}) @ServletComponentScan(value = {"com.accompany", "com.xuanyin"})

View File

@@ -30,7 +30,7 @@ spring:
refresh: true refresh: true
- data-id: sysconf.yml - data-id: sysconf.yml
refresh: true refresh: true
- data-id: threadpool.yml - data-id: dtp.yml
refresh: true refresh: true
--- ---
@@ -53,7 +53,7 @@ spring:
refresh: true refresh: true
- data-id: sysconf.yml - data-id: sysconf.yml
refresh: true refresh: true
- data-id: threadpool.yml - data-id: dtp.yml
refresh: true refresh: true
- data-id: database.yml - data-id: database.yml
refresh: true refresh: true

View File

@@ -26,7 +26,7 @@ import java.util.concurrent.ThreadPoolExecutor;
public class RefreshPersonTask extends BaseTask { public class RefreshPersonTask extends BaseTask {
@Autowired @Autowired
private RoomService roomService; private RoomService roomService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@SneakyThrows @SneakyThrows

View File

@@ -20,7 +20,7 @@ public class UserRechargeLevelTask {
private UserRechargeLevelService service; private UserRechargeLevelService service;
@Autowired @Autowired
private DiamondGiveHistoryMapper diamondGiveHistoryMapper; private DiamondGiveHistoryMapper diamondGiveHistoryMapper;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Scheduled(cron = "1 0 0 * * ?") @Scheduled(cron = "1 0 0 * * ?")

View File

@@ -19,7 +19,7 @@ public class GuildPolicy2SettlementTask {
@Autowired @Autowired
private GuildPolicy2Service guildPolicy2Service; private GuildPolicy2Service guildPolicy2Service;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
/** /**

View File

@@ -22,7 +22,7 @@ public class SSGuildTask {
@Autowired @Autowired
private SSGuildService ssGuildService; private SSGuildService ssGuildService;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
private static final DateTimeFormatter dateFormatters = DateTimeFormatter.ofPattern(DateTimeUtil.DEFAULT_DATETIME_PATTERN); private static final DateTimeFormatter dateFormatters = DateTimeFormatter.ofPattern(DateTimeUtil.DEFAULT_DATETIME_PATTERN);

View File

@@ -32,7 +32,7 @@ public class BravoTask {
private PartitionInfoService partitionInfoService; private PartitionInfoService partitionInfoService;
@Autowired @Autowired
private BravoRecordService service; private BravoRecordService service;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Autowired @Autowired

View File

@@ -19,7 +19,7 @@ import java.util.concurrent.ThreadPoolExecutor;
@Slf4j @Slf4j
public class Lucky24WeekRankTask { public class Lucky24WeekRankTask {
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Autowired @Autowired
private Lucky24SendWeekRankRewardService service; private Lucky24SendWeekRankRewardService service;

View File

@@ -31,7 +31,7 @@ public class Lucky25Task {
private PartitionInfoService partitionInfoService; private PartitionInfoService partitionInfoService;
@Autowired @Autowired
private Lucky25RecordService service; private Lucky25RecordService service;
@Resource(name = "bizExecutor") @Resource(name = "biz-executor")
private ThreadPoolExecutor bizExecutor; private ThreadPoolExecutor bizExecutor;
@Autowired @Autowired

View File

@@ -1,6 +1,7 @@
package com.accompany.scheduler; package com.accompany.scheduler;
import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.MeterRegistry;
import org.dromara.dynamictp.spring.annotation.EnableDynamicTp;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.SpringBootConfiguration;
@@ -15,6 +16,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
* @author PaperCut * @author PaperCut
* @date 2018/6/11 * @date 2018/6/11
*/ */
@EnableDynamicTp
@SpringBootApplication @SpringBootApplication
@ComponentScan({"com.accompany","com.xuanyin"}) @ComponentScan({"com.accompany","com.xuanyin"})
@EnableScheduling @EnableScheduling

View File

@@ -27,7 +27,7 @@ spring:
refresh: true refresh: true
- data-id: sysconf.yml - data-id: sysconf.yml
refresh: true refresh: true
- data-id: threadpool.yml - data-id: dtp.yml
refresh: true refresh: true
--- ---
@@ -50,7 +50,7 @@ spring:
refresh: true refresh: true
- data-id: sysconf.yml - data-id: sysconf.yml
refresh: true refresh: true
- data-id: threadpool.yml - data-id: dtp.yml
refresh: true refresh: true
- data-id: database.yml - data-id: database.yml
refresh: true refresh: true