Hi,

The way log instance inside Logger trait is current being initialized
doesn't seem to be thread safe [1]. Current implementation only guarantees
initializeLogIfNecessary() is initialized in lazy + thread safe way.

Is there a reason why it can't be just: [2]

@transient private lazy val log_ : Logger = {
    initializeLogIfNecessary(false)
    LoggerFactory.getLogger(logName)
  }


And with that initializeLogIfNecessary() can be called without double
locking.

-- 
--
Cheers,
Praj

[1]
https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/internal/Logging.scala#L44-L50
[2]
https://github.com/apache/spark/blob/8ef3399aff04bf8b7ab294c0f55bcf195995842b/core/src/main/scala/org/apache/spark/internal/Logging.scala#L35

Reply via email to