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

Carter Kozak edited comment on LOG4J2-3158 at 9/2/21, 4:38 PM:
---------------------------------------------------------------

Hmm, iteration cost is higher over a CopyOnWriteArrayList (requires iterator 
allocation). It looks like we have a couple race conditions in this class 
though (filed, fix is in testing now: 
https://github.com/apache/logging-log4j2/pull/577) – perhaps we could use an 
AtomicReferenceFieldUpdater to safely CAS array reference values?

I've mostly seen markers used in a way that requires one-time setup so the 
synchronized mutator methods wouldn't be problematic in most use-cases.


was (Author: ckozak):
Hmm, iteration cost is higher over a CopyOnWriteArrayList (requires iterator 
allocation). It looks like we have a couple race conditions in this class 
though – perhaps we could use an AtomicReferenceFieldUpdater to safely CAS 
array reference values?

I've mostly seen markers used in a way that requires one-time setup so the 
synchronized mutator methods wouldn't be problematic in most use-cases.

> Log4jMarker performance improvement
> -----------------------------------
>
>                 Key: LOG4J2-3158
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3158
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: API
>            Reporter: Kirill Listopad
>            Priority: Major
>
> The issue is create regarding to comment: "TODO: use java.util.concurrent" in 
> org.apache.logging.log4j.MarkerManager.Log4jMarker.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to