You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2024/08/31 06:14:19 UTC

(shardingsphere) branch master updated: Refactor AbstractInseparablePipelineJob‘s job stopping judge (#32741)

This is an automated email from the ASF dual-hosted git repository.

zhaojinchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new e38011880a9 Refactor AbstractInseparablePipelineJob‘s job stopping judge (#32741)
e38011880a9 is described below

commit e38011880a9829e2f2eea156226e14907cf9d822
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Aug 31 14:14:12 2024 +0800

    Refactor AbstractInseparablePipelineJob‘s job stopping judge (#32741)
---
 .../data/pipeline/core/job/AbstractInseparablePipelineJob.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/AbstractInseparablePipelineJob.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/AbstractInseparablePipelineJob.java
index 6f770eafe38..bfeb843e569 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/AbstractInseparablePipelineJob.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/AbstractInseparablePipelineJob.java
@@ -58,14 +58,14 @@ public abstract class AbstractInseparablePipelineJob<T extends PipelineJobConfig
     public final void execute(final ShardingContext shardingContext) {
         String jobId = shardingContext.getJobName();
         log.info("Execute job {}", jobId);
+        if (jobRunnerManager.isStopping()) {
+            log.info("Job is stopping, ignore.");
+            return;
+        }
         PipelineJobType jobType = PipelineJobIdUtils.parseJobType(jobId);
         T jobConfig = (T) jobType.getYamlJobConfigurationSwapper().swapToObject(shardingContext.getJobParameter());
         Collection<I> jobItemContexts = new LinkedList<>();
         for (int shardingItem = 0; shardingItem < jobConfig.getJobShardingCount(); shardingItem++) {
-            if (jobRunnerManager.isStopping()) {
-                log.info("Job is stopping, ignore.");
-                return;
-            }
             I jobItemContext = buildJobItemContext(jobConfig, shardingItem);
             if (!jobRunnerManager.addTasksRunner(shardingItem, buildTasksRunner(jobItemContext))) {
                 continue;