summaryrefslogtreecommitdiffstats
path: root/infra/translate-api/src/main/java
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2016-08-31 08:36:24 +0200
committerMaros Marsalek <mmarsale@cisco.com>2016-08-31 06:47:49 +0000
commitd8735d25aae8c51255459099799d626ca31eeb39 (patch)
tree849bb52906abf82514e25053e4b75dfa39899817 /infra/translate-api/src/main/java
parentc961bd752be1fb2eee707cb5c7c44d1bda0894d2 (diff)
HONEYCOMB-144 - Make dump cache manager thread-save
Modified to be thread save and generic to be usable in all plugins Change-Id: I26c90e8c8aa13c07fa389d86a9784e92e9532bcd Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'infra/translate-api/src/main/java')
-rw-r--r--infra/translate-api/src/main/java/io/fd/honeycomb/translate/ModificationCache.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/infra/translate-api/src/main/java/io/fd/honeycomb/translate/ModificationCache.java b/infra/translate-api/src/main/java/io/fd/honeycomb/translate/ModificationCache.java
index dcf97439b..2419ffebe 100644
--- a/infra/translate-api/src/main/java/io/fd/honeycomb/translate/ModificationCache.java
+++ b/infra/translate-api/src/main/java/io/fd/honeycomb/translate/ModificationCache.java
@@ -16,18 +16,21 @@
package io.fd.honeycomb.translate;
-import com.google.common.collect.Maps;
-import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import javax.annotation.concurrent.ThreadSafe;
/**
- * Simple context class that provides transient storage during one or more read/write operations
+ * Simple context class that provides transient storage during one or more read/write operations.
+ * Internally Thread-save.
*/
+@ThreadSafe
public class ModificationCache implements AutoCloseable {
- protected final HashMap<Object, Object> map;
+ protected final Map<Object, Object> map;
public ModificationCache() {
- map = Maps.newHashMap();
+ map = new ConcurrentHashMap<>();
}
public Object get(final Object o) {