diff options
Diffstat (limited to 'common-logging')
-rw-r--r-- | common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventTrackInfo.java | 6 | ||||
-rw-r--r-- | common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/FlexLogger.java | 9 |
2 files changed, 4 insertions, 11 deletions
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventTrackInfo.java b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventTrackInfo.java index 71476c6a..3e021169 100644 --- a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventTrackInfo.java +++ b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventTrackInfo.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-Logging * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,9 +66,7 @@ public class EventTrackInfo { return; } // in case override the start time, check the original event was already stored or not - if (!eventInfo.containsKey(id)) { - eventInfo.put(id, event); - } + eventInfo.putIfAbsent(id, event); } } diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/FlexLogger.java b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/FlexLogger.java index eb6daee9..fadb2545 100644 --- a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/FlexLogger.java +++ b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/FlexLogger.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-Logging * ================================================================================ - * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -179,12 +179,7 @@ public class FlexLogger extends SecurityManager { String className = new FlexLogger().getClassName(); - if (!systemOutMap.containsKey(className)) { - SystemOutLogger logger = new SystemOutLogger(className); - systemOutMap.put(className, logger); - } - - return systemOutMap.get(className); + return systemOutMap.computeIfAbsent(className, SystemOutLogger::new); } /** |