mirror of
https://github.com/apache/maven.git
synced 2025-02-21 17:40:48 +00:00
Simplify logger creation leveraging Map.computeIfAbsent
This commit is contained in:
parent
432bd7af3a
commit
b7a3d85713
@ -49,14 +49,7 @@ public Optional<LogLevelRecorder> getLogLevelRecorder() {
|
||||
*/
|
||||
@Override
|
||||
public Logger getLogger(String name) {
|
||||
Logger simpleLogger = loggerMap.get(name);
|
||||
if (simpleLogger != null) {
|
||||
return simpleLogger;
|
||||
} else {
|
||||
Logger newInstance = getNewLoggingInstance(name);
|
||||
Logger oldInstance = loggerMap.putIfAbsent(name, newInstance);
|
||||
return oldInstance == null ? newInstance : oldInstance;
|
||||
}
|
||||
return loggerMap.computeIfAbsent(name, this::getNewLoggingInstance);
|
||||
}
|
||||
|
||||
private Logger getNewLoggingInstance(String name) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user