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
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
|
zkEventProcessor.shutdown();
|
||||||
try {
|
try {
|
||||||
recoverableZooKeeper.close();
|
if (!zkEventProcessor.awaitTermination(15, TimeUnit.SECONDS)) {
|
||||||
|
LOG.warn("ZKWatcher event processor has not finished to terminate.");
|
||||||
|
zkEventProcessor.shutdownNow();
|
||||||
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
} finally {
|
} finally {
|
||||||
zkEventProcessor.shutdownNow();
|
try {
|
||||||
|
recoverableZooKeeper.close();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue