vinooganesh commented on a change in pull request #28128:
URL: https://github.com/apache/spark/pull/28128#discussion_r428599620
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala
##########
@@ -1064,6 +1055,20 @@ object SparkSession extends Logging {
// Private methods from now on
////////////////////////////////////////////////////////////////////////////////////////
+ private val listenerRegistered: AtomicBoolean = new AtomicBoolean(false)
+
+ /** Register the AppEnd listener onto the Context */
+ private def registerContextListener(sparkContext: SparkContext): Unit = {
+ if (!SparkSession.listenerRegistered.get()) {
Review comment:
fixed!
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala
##########
@@ -1064,6 +1055,20 @@ object SparkSession extends Logging {
// Private methods from now on
////////////////////////////////////////////////////////////////////////////////////////
+ private val listenerRegistered: AtomicBoolean = new AtomicBoolean(false)
+
+ /** Register the AppEnd listener onto the Context */
+ private def registerContextListener(sparkContext: SparkContext): Unit = {
+ if (!SparkSession.listenerRegistered.get()) {
+ sparkContext.addSparkListener(new SparkListener {
+ override def onApplicationEnd(applicationEnd:
SparkListenerApplicationEnd): Unit = {
+ defaultSession.set(null)
+ }
+ })
+ SparkSession.listenerRegistered.set(true)
Review comment:
fixed!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]