You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by si...@apache.org on 2022/01/04 19:10:13 UTC
[atlas] branch branch-2.0 updated: ATLAS-4508: Made the deferred classification tasks sequential
This is an automated email from the ASF dual-hosted git repository.
sidmishra pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 3f80dd2 ATLAS-4508: Made the deferred classification tasks sequential
3f80dd2 is described below
commit 3f80dd28a8c97955a57e13b42a07e4c27f970539
Author: Sidharth Mishra <si...@gmail.com>
AuthorDate: Wed Dec 15 15:20:23 2021 -0800
ATLAS-4508: Made the deferred classification tasks sequential
Signed-off-by: Sidharth Mishra <si...@apache.org>
(cherry picked from commit 8b4ca740acf2b8e67dc89966fe4734b4c5d56b51)
---
.../src/main/java/org/apache/atlas/tasks/TaskManagement.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/repository/src/main/java/org/apache/atlas/tasks/TaskManagement.java b/repository/src/main/java/org/apache/atlas/tasks/TaskManagement.java
index 9a519ba..97b9980 100644
--- a/repository/src/main/java/org/apache/atlas/tasks/TaskManagement.java
+++ b/repository/src/main/java/org/apache/atlas/tasks/TaskManagement.java
@@ -44,7 +44,7 @@ import java.util.concurrent.atomic.AtomicInteger;
public class TaskManagement implements Service, ActiveStateChangeHandler {
private static final Logger LOG = LoggerFactory.getLogger(TaskManagement.class);
- private final ThreadLocal<TaskExecutor> taskExecutorThreadLocal = new ThreadLocal<>();
+ private TaskExecutor taskExecutor;
private final Configuration configuration;
private final TaskRegistry registry;
private final Statistics statistics;
@@ -170,16 +170,16 @@ public class TaskManagement implements Service, ActiveStateChangeHandler {
}
}
- private void dispatchTasks(List<AtlasTask> tasks) {
+ private synchronized void dispatchTasks(List<AtlasTask> tasks) {
if (CollectionUtils.isEmpty(tasks)) {
return;
}
- if (this.taskExecutorThreadLocal.get() == null) {
- this.taskExecutorThreadLocal.set(new TaskExecutor(registry, taskTypeFactoryMap, statistics));
+ if (this.taskExecutor == null) {
+ this.taskExecutor = new TaskExecutor(registry, taskTypeFactoryMap, statistics);
}
- this.taskExecutorThreadLocal.get().addAll(tasks);
+ this.taskExecutor.addAll(tasks);
this.statistics.print();
}