Yao-MR commented on code in PR #51295:
URL: https://github.com/apache/doris/pull/51295#discussion_r2110824950


##########
fe/fe-core/src/main/java/org/apache/doris/scheduler/executor/TransientTaskProcessor.java:
##########
@@ -0,0 +1,57 @@
+package org.apache.doris.scheduler.executor;
+
+import org.apache.doris.catalog.Env;
+import org.apache.doris.job.executor.TaskProcessor;
+import org.apache.doris.scheduler.exception.JobException;
+import org.apache.doris.scheduler.manager.TransientTaskManager;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.io.Closeable;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.ThreadFactory;
+
+public class TransientTaskProcessor extends TaskProcessor implements Closeable 
{
+    private static final Logger LOG = 
LogManager.getLogger(TransientTaskProcessor.class);
+
+    public TransientTaskProcessor(int numberOfThreads, int queueSize, 
ThreadFactory threadFactory) {
+        super(numberOfThreads, queueSize, threadFactory);
+    }
+
+    private boolean isClosed = false;
+
+    public void addTask(Long taskId) throws JobException {
+        if (isClosed) {
+            LOG.info("Add task failed, executor is closed, taskId: {}", 
taskId);
+            return;
+        }
+        try {
+            executor.execute(() -> {
+                try {
+                    TransientTaskManager transientTaskManager = 
Env.getCurrentEnv().getTransientTaskManager();
+                    TransientTaskExecutor taskExecutor = 
transientTaskManager.getMemoryTaskExecutor(taskId);
+                    if (taskExecutor == null) {
+                        LOG.info("Memory task executor is null, task id: {}", 
taskId);
+                        return;
+                    }
+                    taskExecutor.execute();

Review Comment:
   yes, use the task id just avoid the case that another thread cancel the 
task, otherwise, we can not cancel this task,
   and the logistic follow the old code



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to