Skip to content

Commit

Permalink
retry interrupt in blockTillTaskStop
Browse files Browse the repository at this point in the history
  • Loading branch information
tejaskriya committed Feb 23, 2024
1 parent ac3fa89 commit 05cff9a
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,15 @@ 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
LOG.info("In blockTillTaskStop before interrupt, currentThread: {} isInterrupted:{}, balancingThread: {}, isInterrupted:{}",
Thread.currentThread(), Thread.currentThread().isInterrupted(), balancingThread, balancingThread.isInterrupted());
balancingThread.interrupt();
LOG.info("Container Balancer {} isInterrupted {}, waiting for balancing thread {} to stop, isInterrupted: {}",
Thread.currentThread(), Thread.currentThread().isInterrupted(), balancingThread, balancingThread.isInterrupted());
try {
balancingThread.join();
LOG.info("In blockTillTaskStop before interrupt, currentThread: {} isInterrupted:{}, balancingThread: {}, isInterrupted:{}",
Thread.currentThread(), Thread.currentThread().isInterrupted(), balancingThread, balancingThread.isInterrupted());
/*LOG.info("Container Balancer {} isInterrupted {}, waiting for balancing thread {} to stop, isInterrupted: {}",
Thread.currentThread(), Thread.currentThread().isInterrupted(), balancingThread, balancingThread.isInterrupted());*/
while (balancingThread.isAlive()) {
balancingThread.interrupt();
balancingThread.join(5);
}
} catch (InterruptedException exception) {
LOG.info("In Catch of blockTaskTillStop, interrupting currentThread: {}", Thread.currentThread());
Thread.currentThread().interrupt();
Expand Down

0 comments on commit 05cff9a

Please sign in to comment.