Skip to content

Commit

Permalink
async stop
Browse files Browse the repository at this point in the history
  • Loading branch information
turboFei committed Feb 4, 2024
1 parent b39c9b3 commit 4329a85
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,12 @@ case class SparkSQLEngine(spark: SparkSession) extends Serverable("SparkSQLEngin
val elapsedTime = System.currentTimeMillis() - getStartTime
if (!shutdown.get && elapsedTime > maxLifetime) {
if (deregistered.compareAndSet(false, true)) {
info(s"Spark engine has been running for more than $maxLifetime ms," +
s" deregistering from engine discovery space.")
frontendServices.flatMap(_.discoveryService).foreach(_.stop())
ThreadUtils.runInNewThread("engine-de-register", isDaemon = false) {
// for ETCD, the de-registering process might be blocked, so deregister it async
info(s"Spark engine has been running for more than $maxLifetime ms," +
s" deregistering from engine discovery space.")
frontendServices.flatMap(_.discoveryService).foreach(_.stop())
}
}

if (backendService.sessionManager.getOpenSessionCount <= 0) {
Expand Down

0 comments on commit 4329a85

Please sign in to comment.