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

Prajwal Tuladhar commented on SPARK-16131:
------------------------------------------

Also, issue description is a bit misleading. This change doesn't affect thread 
safety of logger instantiation since `lazy val blah = blah` also doesn't care 
about thread safety. This change only uses Scala preferred way of lazy 
initialization of a variable.

> 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
>
> Update
> [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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to