Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22995#discussion_r236471154
  
    --- Diff: 
core/src/main/scala/org/apache/spark/broadcast/TorrentBroadcast.scala ---
    @@ -92,8 +95,15 @@ private[spark] class TorrentBroadcast[T: ClassTag](obj: 
T, id: Long)
       /** The checksum for all the blocks. */
       private var checksums: Array[Int] = _
     
    -  override protected def getValue() = {
    -    _value
    +  override protected def getValue() = synchronized {
    --- End diff --
    
    I noticed that below, the readBroadcastBlock() method is synchronized on 
the companion object, which makes me nervous. However a lazy val is also 
implemented with `this.synchronized`, so I suspect this is fine. We pay the 
cost of synchronization on every call now, but I think that is OK here, as a 
simple flag won't help us figure out whether the SoftReference has been cleared.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to