public interface FineGrainedAtomicMap<K,V> extends Map<K,V>
FineGrainedAtomicMap allows fine grained locking of entries within the map; it also isolates the map for safe
IsolationLevel while concurrent writes may be going on.
AtomicMap implementations also implement the
DeltaAware interface. This powerful interface allows the
generation and application of deltas, and requires that implementations are capable of tracking changes made to it
during the course of a transaction. This helps since when performing replications to update remote nodes, the
entire map need not be serialized and transported all the time, as serializing and transporting
instances would work just as well, and typically be much smaller and hence faster to serialize and transport.
FineGrainedAtomicMap should be constructed and "registered" with Infinispan using the
AtomicMapLookup helper. This
helper ensures thread safe construction and registration of AtomicMap instances in Infinispan's data container. E.g.:
FineGrainedAtomicMap<String, Integer> map = AtomicMapLookup.getFineGrainedAtomicMap(cache, "my_atomic_map_key");
It is important to note that concurrent readers of an AtomicMap will essentially have the same view of the contents of the underlying structure, but since AtomicMaps use internal proxies, readers are isolated from concurrent writes and
IsolationLevel.REPEATABLE_READ semantics are guaranteed.
However, this guarantee is only present if the values stored in an AtomicMap are immutable (e.g., Strings,
primitives, and other immutable types).
Mutable value objects which happen to be stored in an AtomicMap may be updated and, prior to being committed, or even replaced in the map, be visible to concurrent readers. Hence, AtomicMaps are not suitable for use with mutable value objects.
This interface, for all practical purposes, is just a marker interface that indicates that maps of this type will
be locked atomically in the cache and replicated in a fine grained manner, as it does not add any additional methods
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.