You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Remko Popma (JIRA)" <ji...@apache.org> on 2016/03/27 07:43:25 UTC

[jira] [Closed] (LOG4J2-1333) MarkerManager getMarker methods should avoid creating temporary objects

     [ https://issues.apache.org/jira/browse/LOG4J2-1333?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Remko Popma closed LOG4J2-1333.
-------------------------------

> MarkerManager getMarker methods should avoid creating temporary objects
> -----------------------------------------------------------------------
>
>                 Key: LOG4J2-1333
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1333
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: API
>    Affects Versions: 2.5
>            Reporter: Remko Popma
>            Assignee: Remko Popma
>            Priority: Minor
>             Fix For: 2.6
>
>
> Currently MarkerManager's get methods create a new Marker object for each invocation.
> I propose to change this as follows:
> {code}
> // current
> public static Marker getMarker(final String name) {
>     MARKERS.putIfAbsent(name, new Log4jMarker(name));
>     return MARKERS.get(name);
> }
> {code}
> {code}
> // proposed
> public static Marker getMarker(final String name) {
>     Marker result = MARKERS.get(name);
>     if (result == null) {
>         MARKERS.putIfAbsent(name, new Log4jMarker(name));
>         result = MARKERS.get(name);
>     }
>     return result;
> }
> {code}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org