我们使用的 redisson 的延迟队列 爆出来的问题 原因是 我们的 最大线程 最大队列数 数据 已经满了 直接抛出异常
没有配置拒绝策略 直接用默认的拒绝策略来使用的结果
private <T extends DelayEntity> void startThread(DelayedQueueHandler<T> handler) {String queueName = handler.getClass().getSimpleName();delayQueueProperties.getHandlers().entrySet().stream().filter(n -> n.getKey().equalsIgnoreCase(queueName)).map(n -> n.getValue()).findAny().ifPresent(p -> {ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(p.getCorePoolSize(),p.getMaximumPoolSize(),p.getKeepAliveTime(),TimeUnit.MILLISECONDS,new ArrayBlockingQueue<>(p.getBlockingSize()), new DefaultThreadFactory("DELAY")) {@Overrideprotected void beforeExecute(Thread t, Runnable r) {super.beforeExecute(t, r);}@Overrideprotected void afterExecute(Runnable r, Throwable t) {super.afterExecute(r, t);}};
2022-07-14 10:24:48.048 INFO [SimpleHttpHeartbeatSender] Command server port not initialized, won't send heartbeatException in thread "MYDELAYDEMOQUEUEHANDLER-DELAY-QUEUE" java.util.concurrent.RejectedExecutionException: Task cn.com.yto56.basic.framework.plugin.delayed.config.DelayQueueAutoconfiguration$2$$Lambda$945/660561595@75902324 rejected from cn.com.yto56.basic.framework.plugin.delayed.config.DelayQueueAutoconfiguration$2$1@346f64ac[Running, pool size = 10, active threads = 10, queued tasks = 32, completed tasks = 0]at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)at cn.com.yto56.basic.framework.plugin.delayed.config.DelayQueueAutoconfiguration$2.lambda$null$7(DelayQueueAutoconfiguration.java:143)at java.lang.Thread.run(Thread.java:748)
