Package org.infinispan.atomic.impl
Class AtomicMapProxyImpl<K,V,MK>
- java.lang.Object
-
- org.infinispan.atomic.impl.AtomicMapProxyImpl<K,V,MK>
-
- Type Parameters:
K
-V
-MK
-
public class AtomicMapProxyImpl<K,V,MK> extends Object implements AtomicMap<K,V>
This is the proxy class driving access to the entry in cache using functional API. The value in cache is a map of type defined bydataClass()
which is accompanied bydataInstance()
anddataCopy(Map)
. Currently it is implemented byFastCopyHashMap
as we need to create a defensive copy of the value in context. The map is expected to be used with transactional caches; upon map creation or read, the whole map is cached in the transactional context and subsequent reads are served from here. When the map is modified, the change is applied to the local copy in the context. Modifications are added in the form of functional commands to the transaction and executed opon commit. In non-transactional mode this map works correctly, but since any read results in retrieving the whole map, its use might not be very efficient. This behaviour may be addressed in the future. Collections returned bykeySet()
,values()
andentrySet()
are backed by the map. Iterators work on a snapshot obtained at the moment when this iterator is created, and support theIterator.remove()
operation. This implementation does not support fine-grained locking nor fine-grained write-skew check.
-
-
Constructor Summary
Constructors Constructor Description AtomicMapProxyImpl(Cache<MK,Object> cache, FunctionalMap.ReadWriteMap<MK,Object> rw, MK key)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
containsKey(Object subkey)
boolean
containsValue(Object value)
Set<Map.Entry<K,V>>
entrySet()
V
get(Object subkey)
boolean
isEmpty()
Set<K>
keySet()
static <K,V,MK>
AtomicMap<K,V>newInstance(Cache<MK,Object> cache, MK key, boolean createIfAbsent)
V
put(K subkey, V value)
void
putAll(Map<? extends K,? extends V> m)
V
remove(Object subkey)
int
size()
String
toString()
Collection<V>
values()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Method Detail
-
newInstance
public static <K,V,MK> AtomicMap<K,V> newInstance(Cache<MK,Object> cache, MK key, boolean createIfAbsent)
-
containsKey
public boolean containsKey(Object subkey)
- Specified by:
containsKey
in interfaceMap<K,V>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in interfaceMap<K,V>
-
-