diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp')
-rw-r--r-- | openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/context/HostAddressCache.java (renamed from openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/context/HostAddress.java) | 8 | ||||
-rw-r--r-- | openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/GlobalContextProvider.java | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/context/HostAddress.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/context/HostAddressCache.java index bcfef6ca01..afe2b0b1d1 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/context/HostAddress.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/context/HostAddressCache.java @@ -29,22 +29,22 @@ import java.net.UnknownHostException; * @since 26 Mar 2018 */ @SuppressWarnings({"UseOfSystemOutOrSystemErr", "CallToPrintStackTrace", "squid:S106", "squid:S1148"}) -public class HostAddress { +public class HostAddressCache { private static final long DEFAULT_REFRESH_INTERVAL = 60000L; // 1 min private final long interval; - private CacheEntry cachedAddress; + private volatile CacheEntry cachedAddress; - public HostAddress() { + public HostAddressCache() { this(DEFAULT_REFRESH_INTERVAL); } /** * Creates a cache for host address with a custom refresh interval. */ - public HostAddress(long refreshInterval) { + public HostAddressCache(long refreshInterval) { this.interval = refreshInterval; this.cachedAddress = new CacheEntry(System.currentTimeMillis(), read()); } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/GlobalContextProvider.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/GlobalContextProvider.java index 5f2963ec40..97cac2e9ca 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/GlobalContextProvider.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/GlobalContextProvider.java @@ -19,7 +19,7 @@ package org.openecomp.sdc.logging.slf4j; import java.net.InetAddress; import java.util.EnumMap; import java.util.Map; -import org.openecomp.sdc.logging.context.HostAddress; +import org.openecomp.sdc.logging.context.HostAddressCache; import org.openecomp.sdc.logging.context.InstanceId; /** @@ -30,7 +30,7 @@ import org.openecomp.sdc.logging.context.InstanceId; */ class GlobalContextProvider implements ContextProvider { - private static final HostAddress HOST_ADDRESS_CACHE = new HostAddress(); + private static final HostAddressCache HOST_ADDRESS_CACHE = new HostAddressCache(); @Override public Map<ContextField, String> values() { |