dynamic-tp icon indicating copy to clipboard operation
dynamic-tp copied to clipboard

ScheduledDtpExecutor不支持TaskWrapper

Open nathanchoui opened this issue 7 months ago • 2 comments

背景

1.1.8-beta版本下

问题描述

在使用ScheduledDtpExecutor时,指定了taskWrapperNames: [ "custom" ]。无论执行ScheduledDtpExecutor的哪个方法都不会执行指定的TaskWrapper。 经过Debug发现,调用路径ScheduledDtpExecutor#execute(Runnable command) --> ScheduledDtpExecutor#schedule(Runnable command, long delay, TimeUnit unit) --> ScheduledThreadPoolExecutor#schedule(Runnable command, long delay, TimeUnit unit) 。 虽然在ScheduledThreadPoolExecutorProxy实现了execute ScheduledThreadPoolExecutorProxy

    @Override
    public void execute(Runnable command) {
        command = getEnhancedTask(command);
        AwareManager.execute(this, command);
        super.execute(command);
    }

但是在ScheduledDtpExecutor中无论是execute还是schedule方法,都调用的是proxy的schedule方法,该proxy中execute方法根本不会被执行。

这个是设计初衷是什么? 我的理解,executorAware这些扩展在定时任务时失去了意义,可以不支持,但是TaskWrapper是可以实现的,也比较容易实现。 以后版本有支持计划吗?

nathanchoui avatar Jul 01 '24 10:07 nathanchoui