Skip to content

Commit

Permalink
HBASE-27426 - Fix ZKWatcher shutdown seqence to avoid InterruptExcept… (
Browse files Browse the repository at this point in the history
apache#4829)

Signed-off-by: Andrew Purtell <[email protected]>
Signed-off-by: Viraj Jasani <[email protected]>
Co-authored-by: Victor Li <[email protected]>
(cherry picked from commit 39c596f)
Change-Id: Iddff2292973d841df0ca5ec0bd01c0e658723d6c
  • Loading branch information
2 people authored and apurtell committed Oct 29, 2022
1 parent 43f8c76 commit b49b4b7
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -730,12 +730,20 @@ public void interruptedExceptionNoThrow(InterruptedException ie, boolean throwLa
*/
@Override
public void close() {
zkEventProcessor.shutdown();
try {
recoverableZooKeeper.close();
if (!zkEventProcessor.awaitTermination(15, TimeUnit.SECONDS)) {
LOG.warn("ZKWatcher event processor has not finished to terminate.");
zkEventProcessor.shutdownNow();
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
zkEventProcessor.shutdownNow();
try {
recoverableZooKeeper.close();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}

Expand Down

0 comments on commit b49b4b7

Please sign in to comment.