Skip to content

Commit

Permalink
Wait for ZK client to shutdown before returning from close
Browse files Browse the repository at this point in the history
  • Loading branch information
lhotari committed Feb 6, 2024
1 parent 7710880 commit e41d672
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
public class ZKMetadataDriverBase implements AutoCloseable {

protected static final String SCHEME = "zk";
private static final int ZK_CLIENT_WAIT_FOR_SHUTDOWN_TIMEOUT_MS = 5000;

public static String getZKServersFromServiceUri(URI uri) {
String authority = uri.getAuthority();
Expand Down Expand Up @@ -341,7 +342,7 @@ public void close() {
}
if (ownZKHandle && null != zk) {
try {
zk.close();
zk.close(ZK_CLIENT_WAIT_FOR_SHUTDOWN_TIMEOUT_MS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
log.warn("Interrupted on closing zookeeper client", e);
Expand Down

0 comments on commit e41d672

Please sign in to comment.