mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update finalize ykc offline fix baseline
This commit is contained in:
@@ -27,7 +27,7 @@ public class ThreadPoolConfig {
|
||||
// 最大可创建的线程数
|
||||
private final int maxPoolSize = 128; // 突发时翻倍,避免过多上下文切换
|
||||
|
||||
// 队列最大长度 (优化:增大队列容量以应对桩端消息高峰)
|
||||
// 队列最大长度
|
||||
private final int queueCapacity = 5000; // 桩消息短时堆积时提供缓冲,防止直接拒绝
|
||||
|
||||
// 线程池维护线程所允许的空闲时间
|
||||
@@ -51,7 +51,6 @@ public class ThreadPoolConfig {
|
||||
|
||||
/**
|
||||
* 线程池
|
||||
* 优化:使用 DiscardOldestPolicy 避免阻塞调用者线程(如 Netty IO 线程)
|
||||
*/
|
||||
@Bean(name = "threadPoolTaskExecutor")
|
||||
public ThreadPoolTaskExecutor threadPoolTaskExecutor() {
|
||||
@@ -61,8 +60,8 @@ public class ThreadPoolConfig {
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
executor.setKeepAliveSeconds(keepAliveSeconds);
|
||||
// 线程池对拒绝任务(无线程可用)的处理策略
|
||||
// 优化:DiscardOldestPolicy 丢弃最老的任务,避免阻塞调用者线程
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardOldestPolicy());
|
||||
// 关键链路任务不能静默丢弃,回退为调用方执行
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
executor.setThreadNamePrefix(threadNamePrefix);
|
||||
executor.setWaitForTasksToCompleteOnShutdown(true);
|
||||
// log.info("threadPoolTaskExecutor创建成功");
|
||||
|
||||
Reference in New Issue
Block a user