hvanhovell commented on code in PR #45701: URL: https://github.com/apache/spark/pull/45701#discussion_r1571102181
########## connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/SparkSession.scala: ########## @@ -813,6 +823,28 @@ class SparkSession private[sql] ( * Set to false to prevent client.releaseSession on close() (testing only) */ private[sql] var releaseSessionOnClose = true + + private[sql] def registerObservation(planId: Long, observation: Observation): Unit = { + // makes this class thread-safe: + // only the first thread entering this block can set sparkSession + // all other threads will see the exception, as it is only allowed to do this once + observation.synchronized { Review Comment: We should either lock the map, or use a concurrent hash map. Locking the observation should only be needed when we set the value, and even then the observation should be responsible for that. -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org