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
#4829)

Signed-off-by: Andrew Purtell <apurtell@apache.org>
Signed-off-by: Viraj Jasani <vjasani@apache.org>
Co-authored-by: Victor Li <victor.li@salesforce.com>
  • Loading branch information
2 people authored and apurtell committed Oct 17, 2022
1 parent 511e010 commit 6a40867
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -735,12 +735,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 6a40867

Please sign in to comment.