Class FineGrainedAtomicMapProxyImpl<K,​V,​MK>

  • All Implemented Interfaces:
    Map<K,​V>, FineGrainedAtomicMap<K,​V>

    public class FineGrainedAtomicMapProxyImpl<K,​V,​MK>
    extends AbstractMap<K,​V>
    implements FineGrainedAtomicMap<K,​V>
    Implementation of FineGrainedAtomicMap that uses Grouping API to co-locate subkeys on the same node. Therefore the entries in this map are held as regular cache entries, but in order to prevent the need for iterating all data in the owning node we also keep a set of keys under the map's key.

    The implementation requires to be executed on a transactional cache with grouping API enabled. Neither null keys nor null values are supported.

    This cached set implemented by AtomicKeySetImpl is accessed using functional API and can be modified without acquiring its lock as long as we modify the same keys in that transaction.

    Once the map is created or fully read ({@link #size(), keySet(), values() or entrySet()), the whole map (both keys and values) is loaded into context to guarantee repeatable reads semantics. clear() removes only those keys that are known - if the map is read, and another transaction adds a key afterwards, such key may not be removed from the map.

    The map cannot be safely removed (using AtomicMapLookup.removeAtomicMap(Cache, Object) concurrently to another modifications - such operation may result in leaked entries, map being cleared but not removed, failures during commit phase or other undefined behaviour.