majin1102 commented on code in PR #3259:
URL: https://github.com/apache/amoro/pull/3259#discussion_r1811784841


##########
amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingQueue.java:
##########
@@ -353,18 +358,17 @@ private class TableOptimizingProcess implements 
OptimizingProcess, TaskRuntime.T
     private final long targetChangeSnapshotId;
     private final Map<OptimizingTaskId, TaskRuntime<RewriteStageTask>> taskMap 
= Maps.newHashMap();
     private final Queue<TaskRuntime<RewriteStageTask>> taskQueue = new 
LinkedList<>();
-    private final Lock lock = new ReentrantLock();
     private volatile Status status = OptimizingProcess.Status.RUNNING;
     private volatile String failedReason;
     private long endTime = AmoroServiceConstants.INVALID_TIME;
     private Map<String, Long> fromSequence = Maps.newHashMap();
     private Map<String, Long> toSequence = Maps.newHashMap();
     private boolean hasCommitted = false;
 
-    public TaskRuntime poll() {
+    public TaskRuntime<?> poll() {
       lock.lock();
       try {
-        return taskQueue.poll();
+        return status != Status.CLOSED || status != Status.FAILED ? 
taskQueue.poll() : null;

Review Comment:
   I have fixed this. TBR



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to