Skip to content

Commit

Permalink
fix: use double check to fix concurrent problem (#1909)
Browse files Browse the repository at this point in the history
Co-authored-by: zhangwenhe <zhangwh@ehualu.com>
  • Loading branch information
npczwh and zhangwenhe committed Nov 11, 2021
1 parent 0a7b524 commit 89b2072
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ public void run() {
try {
if (workCenter.getLeader() != null && !workCenter.getLeader().equals(this)) {
synchronized (workCenter) {
workCenter.wait();
if (workCenter.getLeader() != null && !workCenter.getLeader().equals(this)) {
workCenter.wait();
continue;
}
}
continue;
}
final Task task = taskSet.getTask();
synchronized (workCenter) {
Expand Down

0 comments on commit 89b2072

Please sign in to comment.