Skip to content

Commit

Permalink
HDDS-8683. Container balancer thread interrupt may not work (apache#6179
Browse files Browse the repository at this point in the history
)

(cherry picked from commit 8c4ab8e)
Change-Id: Ib5da84e949a6a655aaf6d1f8c3e0f03de2560b7f
  • Loading branch information
Tejaskriya authored and jojochuang committed Mar 7, 2024
1 parent 2157700 commit 92c3d87
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,13 @@ private static void blockTillTaskStop(Thread balancingThread) {
// NOTE: join should be called outside the lock in hierarchy
// to avoid locking others waiting
// wait for balancingThread to die with interrupt
balancingThread.interrupt();
LOG.info("Container Balancer waiting for {} to stop", balancingThread);
try {
balancingThread.join();
while (balancingThread.isAlive()) {
// retry interrupt every 5ms to avoid waiting when thread is sleeping
balancingThread.interrupt();
balancingThread.join(5);
}
} catch (InterruptedException exception) {
Thread.currentThread().interrupt();
}
Expand Down

0 comments on commit 92c3d87

Please sign in to comment.