TakawaAkirayo commented on code in PR #46182:
URL: https://github.com/apache/spark/pull/46182#discussion_r1584047060


##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/service/SparkConnectServer.scala:
##########
@@ -36,21 +32,21 @@ object SparkConnectServer extends Logging {
     try {
       try {
         SparkConnectService.start(session.sparkContext)
-        SparkConnectService.server.getListenSockets.asScala.foreach { sa =>
-          val isa = sa.asInstanceOf[InetSocketAddress]
-          logInfo(
-            log"Spark Connect server started at: " +
-              log"${MDC(HOST, isa.getAddress.getHostAddress)}:${MDC(PORT, 
isa.getPort)}")
-        }
+        val isa = SparkConnectService.bindingAddress
+        logInfo(
+          log"Spark Connect server started at: " +
+            log"${MDC(HOST, isa.getAddress.getHostAddress)}:${MDC(PORT, 
isa.getPort)}")
       } catch {
         case e: Exception =>
           logError("Error starting Spark Connect server", e)
           System.exit(-1)
       }
       SparkConnectService.server.awaitTermination()
     } finally {
+      if (SparkConnectService.started) {
+        SparkConnectService.stop()
+      }
       session.stop()
-      SparkConnectService.uiTab.foreach(_.detach())

Review Comment:
   @grundprinzip The SparkConnectService.stop() is used here, the uiTab's 
detaching contained in the stop().
   
   ```
   finally {
         if (SparkConnectService.started) {
           SparkConnectService.stop()
         }
         session.stop()
       }
   ```
   
   In this PR, the SparkConnectService.start() method will post a Service Start 
event containing the address of the SparkConnectService, while the 
SparkConnectService.stop() method will post a Service End event. The purpose is 
to ensure that these two events occur in pairs for the Spark Listeners.



-- 
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