logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remko Popma (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (LOG4J2-1333) MarkerManager getMarker methods should avoid creating temporary objects
Date Sun, 27 Mar 2016 05:43:25 GMT

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

Remko Popma resolved LOG4J2-1333.
---------------------------------
    Resolution: Fixed

Fixed in master in commit 0f750eb.

> 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


Mime
View raw message