get the lastOption of serverList

This commit is contained in:
Kent Yao 2020-12-21 16:31:54 +08:00
parent e8bc44c2ad
commit d8e5c5aa4a
No known key found for this signature in database
GPG Key ID: A4F0BE81C89B595B

View File

@ -68,7 +68,9 @@ class KyuubiSessionImpl(
private def getServerHost: Option[(String, Int)] = {
try {
val hosts = zkClient.getChildren.forPath(zkPath)
hosts.asScala.headOption.map { p =>
// TODO: use last one because to avoid touching some maybe-crashed engines
// We need a big improvement here.
hosts.asScala.lastOption.map { p =>
val path = ZKPaths.makePath(null, zkNamespace, p)
val hostPort = new String(zkClient.getData.forPath(path), StandardCharsets.UTF_8)
val strings = hostPort.split(":")