Remko Popma created LOG4J2-1333:
-----------------------------------
Summary: 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: [email protected]
For additional commands, e-mail: [email protected]