我们使用的 redisson 的延迟队列 爆出来的问题 原因是 我们的 最大线程 最大队列数 数据 已经满了 直接抛出异常

    没有配置拒绝策略 直接用默认的拒绝策略来使用的结果

    1. private <T extends DelayEntity> void startThread(DelayedQueueHandler<T> handler) {
    2. String queueName = handler.getClass().getSimpleName();
    3. delayQueueProperties
    4. .getHandlers()
    5. .entrySet()
    6. .stream()
    7. .filter(n -> n.getKey().equalsIgnoreCase(queueName)).map(n -> n.getValue())
    8. .findAny().ifPresent(p -> {
    9. ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(
    10. p.getCorePoolSize(),
    11. p.getMaximumPoolSize(),
    12. p.getKeepAliveTime(),
    13. TimeUnit.MILLISECONDS,
    14. new ArrayBlockingQueue<>(p.getBlockingSize()), new DefaultThreadFactory("DELAY")
    15. ) {
    16. @Override
    17. protected void beforeExecute(Thread t, Runnable r) {
    18. super.beforeExecute(t, r);
    19. }
    20. @Override
    21. protected void afterExecute(Runnable r, Throwable t) {
    22. super.afterExecute(r, t);
    23. }
    24. };
    1. 2022-07-14 10:24:48.048 INFO [SimpleHttpHeartbeatSender] Command server port not initialized, won't send heartbeat
    2. Exception 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]
    3. at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)
    4. at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
    5. at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
    6. at cn.com.yto56.basic.framework.plugin.delayed.config.DelayQueueAutoconfiguration$2.lambda$null$7(DelayQueueAutoconfiguration.java:143)
    7. at java.lang.Thread.run(Thread.java:748)