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

Ralph Goers edited comment on LOG4J2-3459 at 3/31/22, 2:44 AM:
---------------------------------------------------------------

You are going to have to be more specific. The use of static initializer blocks 
comes with the guarantee of thread safety so it is often the most preferable 
method of initialization. I would prefer a minor startup overhead to the cost 
of introducing bugs that are hard to find and fix.


was (Author: ralph.go...@dslextreme.com):
You are going to have to be more specific. The use of static initializer blocks 
comes with the guarantee of thread safety so it is often the most preferable 
method of initialization.

> Reduce use of class static initialization blocks
> ------------------------------------------------
>
>                 Key: LOG4J2-3459
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3459
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: API, Core
>            Reporter: Matt Sicker
>            Priority: Major
>
> There are numerous classes that use static initializer blocks to perform 
> computation for caching some results. These should all generally be deferred 
> until some other reference to the class such as instantiation of use of a 
> singleton getter method.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to