From d2a001a896ab0d0b222b4a8e800f74183713d306 Mon Sep 17 00:00:00 2001 From: ulysses-you Date: Mon, 1 Mar 2021 17:28:22 +0800 Subject: [PATCH] address comment --- .../kyuubi/engine/spark/session/SessionSuite.scala | 9 +++++---- .../scala/org/apache/kyuubi/service/Serverable.scala | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/kyuubi/engine/spark/session/SessionSuite.scala b/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/kyuubi/engine/spark/session/SessionSuite.scala index 8d463b62075..a18ab9f50ad 100644 --- a/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/kyuubi/engine/spark/session/SessionSuite.scala +++ b/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/kyuubi/engine/spark/session/SessionSuite.scala @@ -24,9 +24,11 @@ import org.apache.kyuubi.Utils import org.apache.kyuubi.config.KyuubiConf._ import org.apache.kyuubi.engine.spark.{SparkSQLEngine, WithSparkSQLEngine} import org.apache.kyuubi.operation.JDBCTestUtils +import org.apache.kyuubi.service.ServiceState._ class SessionSuite extends WithSparkSQLEngine with JDBCTestUtils { override def beforeAll(): Unit = { + System.setProperty(ENGINE_SHARED_LEVEL.key, "CONNECTION") } override def afterAll(): Unit = { @@ -42,7 +44,6 @@ class SessionSuite extends WithSparkSQLEngine with JDBCTestUtils { s"jdbc:derby:;databaseName=$metastorePath;create=true") System.setProperty("spark.sql.warehouse.dir", warehousePath.toString) System.setProperty("spark.sql.hive.metastore.sharedPrefixes", "org.apache.hive.jdbc") - System.setProperty(ENGINE_SHARED_LEVEL.key, "CONNECTION") spark = SparkSQLEngine.createSpark() engine = SparkSQLEngine.startEngine(spark) } @@ -62,10 +63,10 @@ class SessionSuite extends WithSparkSQLEngine with JDBCTestUtils { override protected def jdbcUrl: String = s"jdbc:hive2://${engine.connectionUrl}/;" test("release session if shared level is CONNECTION") { - assert(engine.started.get) + assert(engine.getServiceState == STARTED) withJdbcStatement() {_ => } - eventually(Timeout(60.seconds)) { - assert(!engine.started.get) + eventually(Timeout(200.seconds)) { + assert(engine.getServiceState == STARTED) } } } diff --git a/kyuubi-common/src/main/scala/org/apache/kyuubi/service/Serverable.scala b/kyuubi-common/src/main/scala/org/apache/kyuubi/service/Serverable.scala index 6f855a2f1a3..8c52fd45e22 100644 --- a/kyuubi-common/src/main/scala/org/apache/kyuubi/service/Serverable.scala +++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/service/Serverable.scala @@ -24,7 +24,7 @@ import org.apache.kyuubi.config.KyuubiConf abstract class Serverable(name: String) extends CompositeService(name) { private val OOMHook = new Runnable { override def run(): Unit = stop() } - private[kyuubi] val started = new AtomicBoolean(false) + private val started = new AtomicBoolean(false) private[kyuubi] val backendService: AbstractBackendService private lazy val frontendService = new FrontendService(backendService, OOMHook)