Skip to content

Commit

Permalink
use short sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
turboFei committed Feb 4, 2024
1 parent 7c123f6 commit b39c9b3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ case class SparkSQLEngine(spark: SparkSession) extends Serverable("SparkSQLEngin
info(s"Spark engine is de-registering from engine discovery space.")
frontendServices.flatMap(_.discoveryService).foreach(_.stop())
while (backendService.sessionManager.getOpenSessionCount > 0) {
Thread.sleep(1000 * 60)
Thread.sleep(TimeUnit.SECONDS.toMillis(5))
}
info(s"Spark engine has no open session now, terminating.")
stop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.kyuubi.ha.client

import java.util.concurrent.CountDownLatch
import java.util.concurrent.{CountDownLatch, TimeUnit}
import java.util.concurrent.atomic.AtomicBoolean

import org.apache.kyuubi.Logging
Expand Down Expand Up @@ -68,7 +68,7 @@ abstract class ServiceDiscovery(
def stopGracefully(isLost: Boolean = false): Unit = {
while (fe.be.sessionManager.getOpenSessionCount > 0) {
info(s"${fe.be.sessionManager.getOpenSessionCount} connection(s) are active, delay shutdown")
Thread.sleep(1000 * 60)
Thread.sleep(TimeUnit.SECONDS.toMillis(5))
}
isServerLost.set(isLost)
gracefulShutdownLatch.countDown()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class EtcdDiscoveryClient(conf: KyuubiConf) extends DiscoveryClient {
var lockClient: Lock = _
var leaseClient: Lease = _
var serviceNode: ServiceNode = _
var serviceDiscovery: ServiceDiscovery = _

var leaseTTL: Long = _

Expand Down Expand Up @@ -158,7 +157,7 @@ class EtcdDiscoveryClient(conf: KyuubiConf) extends DiscoveryClient {
}

override def monitorState(serviceDiscovery: ServiceDiscovery): Unit = {
this.serviceDiscovery = serviceDiscovery
// not need with etcd
}

override def tryWithLock[T](
Expand Down Expand Up @@ -277,10 +276,6 @@ class EtcdDiscoveryClient(conf: KyuubiConf) extends DiscoveryClient {
}
serviceNode = null
}
if (serviceDiscovery != null) {
serviceDiscovery.stopGracefully(true)
serviceDiscovery = null
}
}

override def postDeregisterService(namespace: String): Boolean = {
Expand Down

0 comments on commit b39c9b3

Please sign in to comment.