aboutsummaryrefslogtreecommitdiffstats
path: root/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-03-20 14:49:45 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-20 14:49:45 +0000
commitff1b759ff023dc9a940ab9de4333adcac82b9867 (patch)
tree039e5ae2835874dbcbdf7ba7981b853242c51655 /common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java
parent77ad3209e44b4d749cf45d2c5b2bd9e0214e9c9c (diff)
parent5492c1dd9d7052781ae5cab28bf5bcc829ae9c9e (diff)
Merge "Removed checkstyle warnings"
Diffstat (limited to 'common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java')
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java45
1 files changed, 20 insertions, 25 deletions
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java
index 97f61699..e5f5e65b 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 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.
@@ -27,32 +27,27 @@ import org.onap.policy.common.logging.nsa.LoggingContext;
import org.onap.policy.common.logging.nsa.SharedLoggingContext;
/**
- * A shared logging context for SLF4J
+ * A shared logging context for SLF4J.
*
*/
-public class SharedContext extends Slf4jLoggingContext implements SharedLoggingContext
-{
- private final HashMap<String,String> fMap;
-
- public SharedContext ( LoggingContext base )
- {
- super ( base );
- fMap = new HashMap<> ();
- }
+public class SharedContext extends Slf4jLoggingContext implements SharedLoggingContext {
+ private final HashMap<String, String> contextMap;
- @Override
- public void put ( String key, String value )
- {
- super.put ( key, value );
- fMap.put ( key, value );
- }
+ public SharedContext(LoggingContext base) {
+ super(base);
+ contextMap = new HashMap<>();
+ }
- @Override
- public void transferTo ( SharedLoggingContext lc )
- {
- for ( Entry<String,String> e : fMap.entrySet () )
- {
- lc.put ( e.getKey(), e.getValue() );
- }
- }
+ @Override
+ public void put(String key, String value) {
+ super.put(key, value);
+ contextMap.put(key, value);
+ }
+
+ @Override
+ public void transferTo(SharedLoggingContext lc) {
+ for (Entry<String, String> e : contextMap.entrySet()) {
+ lc.put(e.getKey(), e.getValue());
+ }
+ }
}