作者 若依
提交者 Gitee

!414 优化任务队列满时任务拒绝策略

Merge pull request !414 from root/master
@@ -3,6 +3,7 @@ package com.ruoyi.common.core.domain.entity; @@ -3,6 +3,7 @@ package com.ruoyi.common.core.domain.entity;
3 import java.util.ArrayList; 3 import java.util.ArrayList;
4 import java.util.List; 4 import java.util.List;
5 import javax.validation.constraints.NotBlank; 5 import javax.validation.constraints.NotBlank;
  6 +import javax.validation.constraints.NotNull;
6 import javax.validation.constraints.Size; 7 import javax.validation.constraints.Size;
7 import org.apache.commons.lang3.builder.ToStringBuilder; 8 import org.apache.commons.lang3.builder.ToStringBuilder;
8 import org.apache.commons.lang3.builder.ToStringStyle; 9 import org.apache.commons.lang3.builder.ToStringStyle;
@@ -30,7 +31,7 @@ public class SysMenu extends BaseEntity @@ -30,7 +31,7 @@ public class SysMenu extends BaseEntity
30 private Long parentId; 31 private Long parentId;
31 32
32 /** 显示顺序 */ 33 /** 显示顺序 */
33 - private String orderNum; 34 + private Integer orderNum;
34 35
35 /** 路由地址 */ 36 /** 路由地址 */
36 private String path; 37 private String path;
@@ -107,13 +108,13 @@ public class SysMenu extends BaseEntity @@ -107,13 +108,13 @@ public class SysMenu extends BaseEntity
107 this.parentId = parentId; 108 this.parentId = parentId;
108 } 109 }
109 110
110 - @NotBlank(message = "显示顺序不能为空")  
111 - public String getOrderNum() 111 + @NotNull(message = "显示顺序不能为空")
  112 + public Integer getOrderNum()
112 { 113 {
113 return orderNum; 114 return orderNum;
114 } 115 }
115 116
116 - public void setOrderNum(String orderNum) 117 + public void setOrderNum(Integer orderNum)
117 { 118 {
118 this.orderNum = orderNum; 119 this.orderNum = orderNum;
119 } 120 }
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)