[ 
https://issues.apache.org/jira/browse/SPARK-16131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15344913#comment-15344913
 ] 

Shixiong Zhu edited comment on SPARK-16131 at 6/22/16 6:11 PM:
---------------------------------------------------------------

I'd say that it's safe but ineffective. LoggerFactory.getLogger is thread-safe 
and will return the existing one if there is any.


was (Author: zsxwing):
I'd say that it's say but ineffective. LoggerFactory.getLogger is thread-safe 
and will return the existing one if there is any.

> initialize internal logger lazily instead of manual null check
> --------------------------------------------------------------
>
>                 Key: SPARK-16131
>                 URL: https://issues.apache.org/jira/browse/SPARK-16131
>             Project: Spark
>          Issue Type: Improvement
>          Components: Spark Core
>            Reporter: Prajwal Tuladhar
>            Priority: Minor
>
> 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. 
> [1] 
> https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/internal/Logging.scala#L44-L50
> This can be written as:
> {code}
> @transient private lazy val log_ : Logger = {
>     initializeLogIfNecessary(false)
>     LoggerFactory.getLogger(logName)
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to