Github user ueshin commented on the issue:

    https://github.com/apache/spark/pull/20404
  
    @HyukjinKwon I'm afraid that's not enough because we need to synchronize at 
all the places we touch the `defaultSession`, otherwise another thread can set 
the value between `defaultSession.get() eq null` and 
`defaultSession.set(session)`.
    
    Fortunately `defaultSession` is an `AtomicReference`, so maybe we can use 
`defaultSession.compareAndSet(null, session)` without the synchronization in 
the method `setDefaultSessionIfUnset()` if we only need to set the default 
session is `null`.
    
    I'm not sure whether we want to replace the default session which is 
already stopped, but in that case, we may also have to send the original 
default session to compare.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to