ZkClient should close when the session is opened

fixes #260

Squashed commit of the following:

commit ed4fa0cad9f8ad0053035b44a3ca703dd49ba362
Author: zen <xinjingziranchan@gmail.com>
Date:   Fri Dec 11 11:13:32 2020 +0800

    release the zkClient after session established.

commit add46a6acaa19942fcea3175ae253fdae2ef525b
Author: zen <xinjingziranchan@gmail.com>
Date:   Thu Dec 10 14:49:26 2020 +0800

    ZkClient should close when the session is opened.
This commit is contained in:
Zen 2020-12-11 15:49:34 +08:00 committed by Kent Yao
parent d357203b0e
commit 7fd6f71271

View File

@ -17,6 +17,7 @@
package org.apache.kyuubi.session
import java.io.IOException
import java.nio.charset.StandardCharsets
import java.util.concurrent.TimeUnit
@ -107,6 +108,11 @@ class KyuubiSessionImpl(
val Some((host, port)) = getServerHost
openSession(host, port)
}
try {
zkClient.close()
} catch {
case e: IOException => error("Failed to release the zkClient after session established", e)
}
}
private def openSession(host: String, port: Int): Unit = {
@ -144,6 +150,5 @@ class KyuubiSessionImpl(
transport.close()
}
}
zkClient.close()
}
}