HBASE-27426 - Fix ZKWatcher shutdown seqence to avoid InterruptExcept… (#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>
This commit is contained in:
parent
511e0105ae
commit
6a40867804
|
@ -735,12 +735,20 @@ public class ZKWatcher implements Watcher, Abortable, Closeable {
|
|||
*/
|
||||
@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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue