KYUUBI-125 fix the error when create session in SparkSessionWithUGI

This commit is contained in:
hustfeiwang 2018-11-27 19:45:55 +08:00
parent d1d34e5856
commit e60f10b927

View File

@ -156,9 +156,11 @@ class SparkSessionWithUGI(
conf.setAppName(appName)
configureSparkConf(sessionConf)
val totalWaitTime: Long = conf.getTimeAsSeconds(BACKEND_SESSTION_INIT_TIMEOUT)
var newContextThread: Thread = null
try {
KyuubiHadoopUtil.doAs(user) {
newContext().start()
newContextThread = newContext()
newContextThread.start()
val context =
Await.result(promisedSparkContext.future, Duration(totalWaitTime, TimeUnit.SECONDS))
_sparkSession = ReflectUtils.newInstance(
@ -181,7 +183,9 @@ class SparkSessionWithUGI(
throw ke
} finally {
SparkSessionWithUGI.setFullyConstructed(userName)
newContext().join()
if (newContextThread != null) {
newContextThread.join()
}
}
KyuubiServerMonitor.setListener(userName, new KyuubiServerListener(conf))