Skip to content

[BUG]: scheduled线程池类型配置自定义taskWrapperNames无效 #581

@yiyi910

Description

@yiyi910

平台

Windows

Jdk版本

JDK 21

SpringBoot版本

2.7.18

DynamicTp版本

1.2.2

配置中心类型

无配置中心

配置中心版本

问题描述

问题描述:断点调试ScheduledDtpExecutor的schedule方法,查看当前对象的taskWrappers属性是有自定义的TaskWrapper实例,但delegate的taskWrappers是空集合

application.yaml配置文件:

dynamicpt:
  ...
  executors:
    - threadPoolName: scheduledThreadPool
      threadPoolAliasName: "spring定时任务线程池"
	  executorType: scheduled
	  taskWrapperNames: ["reqId"]
	  ...
	  

spring Scheduling配置类:

@Configuration
public class MyScheduledConfig implements SchedulingConfigurer {
	public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
		ThreadPoolExecutor scheduledThreadPool = DtpRegistry.getDtpExecutor("scheduledThreadPool");
		taskRegistrar.setScheduler(scheduledThreadPool);
	}
}

复现步骤

  1. jdk21 + springboot 2.7.18 + dynamictp 1.2.2

其他信息

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions