From 75513e59ee71cef38719324e631dc6fcab33388c Mon Sep 17 00:00:00 2001 From: json <1067370987@qq.com> Date: Fri, 6 Dec 2024 11:07:52 +0800 Subject: [PATCH] =?UTF-8?q?[BugFix][Admin]Fix=20dolphinscheduler=20calls?= =?UTF-8?q?=20dinky=20tasks=20and=20concurrent=20=E2=80=A6=20(#4010)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 黄苏苏 --- .../src/main/java/org/dinky/service/task/BaseTask.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dinky-admin/src/main/java/org/dinky/service/task/BaseTask.java b/dinky-admin/src/main/java/org/dinky/service/task/BaseTask.java index bb41ea9db1..f13659fd3f 100644 --- a/dinky-admin/src/main/java/org/dinky/service/task/BaseTask.java +++ b/dinky-admin/src/main/java/org/dinky/service/task/BaseTask.java @@ -39,6 +39,10 @@ @AllArgsConstructor public abstract class BaseTask { + + private static final Set> taskRegistry = + ClassUtil.scanPackageBySuper(BaseTask.class.getPackage().getName(), BaseTask.class); + final TaskDTO task; public abstract JobResult execute() throws Exception; @@ -58,9 +62,7 @@ public ObjectNode getJobPlan() throws NotSupportExplainExcepition { } public static BaseTask getTask(TaskDTO taskDTO) { - Set> classes = - ClassUtil.scanPackageBySuper(BaseTask.class.getPackage().getName(), BaseTask.class); - for (Class clazz : classes) { + for (Class clazz : taskRegistry) { SupportDialect annotation = clazz.getAnnotation(SupportDialect.class); if (annotation != null) { for (Dialect dialect : annotation.value()) {