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
b68229c479
commit
77a21b93c5
|
@ -735,12 +735,20 @@ public class ZKWatcher implements Watcher, Abortable, Closeable {
|
|||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
zkEventProcessor.shutdown();
|
||||
try {
|
||||
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 {
|
||||
try {
|
||||
recoverableZooKeeper.close();
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
} finally {
|
||||
zkEventProcessor.shutdownNow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue