risyomei commented on code in PR #5002:
URL: https://github.com/apache/kyuubi/pull/5002#discussion_r1248813072


##########
externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/SparkSQLEngine.scala:
##########
@@ -114,6 +127,29 @@ case class SparkSQLEngine(spark: SparkSession) extends 
Serverable("SparkSQLEngin
     stopEngineExec.get.execute(stopTask)
   }
 
+  private[kyuubi] def startFastFailChecker(): Unit = {
+    val interval = conf.get(ENGINE_CHECK_INTERVAL)
+    val timeout = conf.get(ENGINE_SPARK_MAX_INITIAL_WAIT)
+    val failFastCheck: Runnable = () => {
+      if (!shutdown.get) {
+        while (backendService.sessionManager.getOpenSessionCount <= 0 &&
+          System.currentTimeMillis() - getStartTime < timeout) {
+          info(s"Waiting for the initial connection")
+          Thread.sleep(interval)
+        }
+        if (backendService.sessionManager.getOpenSessionCount <= 0) {
+          error(s"Spark engine has been terminated because no incoming 
connection" +
+            s" for more than $timeout ms, de-registering from engine discovery 
space.")
+          assert(currentEngine.isDefined)
+          currentEngine.get.stop()
+        }
+      }
+    }
+    failfastChecker =
+      Some(ThreadUtils.newDaemonFixedThreadPool(1, 
"spark-engine-failfast-checker"))

Review Comment:
   Got it, let me fix it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to