正在显示
1 个修改的文件
包含
7 行增加
和
5 行删除
| 1 | package com.ruoyi.framework.config; | 1 | package com.ruoyi.framework.config; |
| 2 | 2 | ||
| 3 | -import java.util.concurrent.ScheduledExecutorService; | ||
| 4 | -import java.util.concurrent.ScheduledThreadPoolExecutor; | ||
| 5 | -import java.util.concurrent.ThreadPoolExecutor; | 3 | +import com.ruoyi.common.utils.Threads; |
| 6 | import org.apache.commons.lang3.concurrent.BasicThreadFactory; | 4 | import org.apache.commons.lang3.concurrent.BasicThreadFactory; |
| 7 | import org.springframework.context.annotation.Bean; | 5 | import org.springframework.context.annotation.Bean; |
| 8 | import org.springframework.context.annotation.Configuration; | 6 | import org.springframework.context.annotation.Configuration; |
| 9 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | 7 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| 10 | -import com.ruoyi.common.utils.Threads; | 8 | + |
| 9 | +import java.util.concurrent.ScheduledExecutorService; | ||
| 10 | +import java.util.concurrent.ScheduledThreadPoolExecutor; | ||
| 11 | +import java.util.concurrent.ThreadPoolExecutor; | ||
| 11 | 12 | ||
| 12 | /** | 13 | /** |
| 13 | * 线程池配置 | 14 | * 线程池配置 |
| @@ -49,7 +50,8 @@ public class ThreadPoolConfig | @@ -49,7 +50,8 @@ public class ThreadPoolConfig | ||
| 49 | protected ScheduledExecutorService scheduledExecutorService() | 50 | protected ScheduledExecutorService scheduledExecutorService() |
| 50 | { | 51 | { |
| 51 | return new ScheduledThreadPoolExecutor(corePoolSize, | 52 | return new ScheduledThreadPoolExecutor(corePoolSize, |
| 52 | - new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()) | 53 | + new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build(), |
| 54 | + new ThreadPoolExecutor.CallerRunsPolicy()) | ||
| 53 | { | 55 | { |
| 54 | @Override | 56 | @Override |
| 55 | protected void afterExecute(Runnable r, Throwable t) | 57 | protected void afterExecute(Runnable r, Throwable t) |
-
请 注册 或 登录 后发表评论