You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/03/06 13:24:45 UTC

[GitHub] [dolphinscheduler] caishunfeng commented on a change in pull request #8707: [Fix][Master] Fix master-server execution logic thread unsafe problem

caishunfeng commented on a change in pull request #8707:
URL: https://github.com/apache/dolphinscheduler/pull/8707#discussion_r820233934



##########
File path: dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
##########
@@ -120,7 +121,7 @@ public void run() {
      * batch dispatch with thread pool
      */
     private List<TaskPriority> batchDispatch(int fetchTaskNum) throws TaskPriorityQueueException, InterruptedException {
-        List<TaskPriority> failedDispatchTasks = new ArrayList<>();
+        List<TaskPriority> failedDispatchTasks = Collections.synchronizedList(new ArrayList<>());

Review comment:
       This is the funtion execute in the single thread, so is it necessary to use the `Collections.synchronizedList`? 
   Will it affect performance?

##########
File path: dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
##########
@@ -179,7 +180,8 @@ private void scheduleProcess() throws Exception {
     }
 
     private List<ProcessInstance> command2ProcessInstance(List<Command> commands) {
-        List<ProcessInstance> processInstances = new ArrayList<>(commands.size());
+
+        List<ProcessInstance> processInstances = Collections.synchronizedList(new ArrayList<>(commands.size()));

Review comment:
       The same question.




-- 
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-unsubscribe@dolphinscheduler.apache.org

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