hvanhovell commented on code in PR #42355:
URL: https://github.com/apache/spark/pull/42355#discussion_r1285254250


##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/execution/ExecuteGrpcResponseSender.scala:
##########
@@ -58,6 +61,39 @@ private[connect] class ExecuteGrpcResponseSender[T <: 
MessageLite](
     detached = true
   }
 
+  def run(lastConsumedStreamIndex: Long): Unit = {
+
+    // In reattachable execution, we check if grpcCallObserver is ready for 
sending.
+    // See sendResponse
+    if (executeHolder.reattachable && flowControl) {
+      val grpcCallObserver = 
grpcObserver.asInstanceOf[ServerCallStreamObserver[T]]
+      grpcCallObserver.setOnReadyHandler(() => {
+        val e = new Exception()
+        logError(s"ON READY\n${e.getStackTrace.mkString("\n")}")
+        grpcCallObserverReadySignal.synchronized {
+          grpcCallObserverReadySignal.notifyAll()
+        }
+      })
+    }
+
+    // We run in a separate daemon thread
+    val t = new Thread {
+      override def run(): Unit = {
+        try {
+          execute(lastConsumedStreamIndex)
+        } finally {
+          if (!executeHolder.reattachable) {
+            // Non reattachable executions release here immediately.
+            // (Reattachable executions close release with ReleaseExecute RPC.)
+            executeHolder.close()
+          }
+        }
+      }
+    }
+    t.setDaemon(true) // can I not set daemon and just don't join?

Review Comment:
   If you do that and the application tries to terminate it won't... You don't 
have to join.



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