LuciferYang commented on code in PR #41097:
URL: https://github.com/apache/spark/pull/41097#discussion_r1926533550
##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -569,14 +569,38 @@ class SparkSession private[sql] (
override def close(): Unit = {
client.shutdown()
allocator.close()
+ SparkSession.onSessionClose(this)
}
}
// The minimal builder needed to create a spark session.
// TODO: implements all methods mentioned in the scaladoc of [[SparkSession]]
object SparkSession extends Logging {
+ private val MAX_CACHED_SESSIONS = 100
private val planIdGenerator = new AtomicLong
+ private val sessions = CacheBuilder
+ .newBuilder()
+ .weakValues()
+ .maximumSize(MAX_CACHED_SESSIONS)
Review Comment:
@hvanhovell Should we add a removalListener for `sessions` to close the
`SparkSession` that is automatically evicted?
--
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]