Skip to content

Commit

Permalink
[ARCTIC-1018][AMS] Avoiding concurrent operations by tasksLock (#1022)
Browse files Browse the repository at this point in the history
* [ARCTIC-1018][AMS] LinkedHashMap modified to ConcurrentHashMap

* Revert "[ARCTIC-1018][AMS] LinkedHashMap modified to ConcurrentHashMap"

This reverts commit 4b262fe.

* [ARCTIC-1018][AMS] Avoiding concurrent operations by `tasksLock`
  • Loading branch information
zhongqishang authored Jan 29, 2023
1 parent a68787b commit cb22511
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -858,12 +858,17 @@ public List<OptimizeTaskItem> getOptimizeTasksToExecute() {
* If task execute timeout, set it to be Failed.
*/
public void checkTaskExecuteTimeout() {
optimizeTasks.values().stream().filter(OptimizeTaskItem::executeTimeout)
.forEach(task -> {
task.onFailed(new ErrorMessage(System.currentTimeMillis(), "execute expired"),
System.currentTimeMillis() - task.getOptimizeRuntime().getExecuteTime());
LOG.error("{} execute timeout, change to Failed", task.getTaskId());
});
tasksLock.lock();
try {
optimizeTasks.values().stream().filter(OptimizeTaskItem::executeTimeout)
.forEach(task -> {
task.onFailed(new ErrorMessage(System.currentTimeMillis(), "execute expired"),
System.currentTimeMillis() - task.getOptimizeRuntime().getExecuteTime());
LOG.error("{} execute timeout, change to Failed", task.getTaskId());
});
} finally {
tasksLock.unlock();
}
}

/**
Expand Down

0 comments on commit cb22511

Please sign in to comment.