Interface AtomicMap<K,V>

All Superinterfaces:
All Known Implementing Classes:
AtomicHashMap, AtomicHashMapProxy

public interface AtomicMap<K,V>
extends Map<K,V>

This is a special type of Map geared for use in Infinispan. AtomicMaps have two major characteristics:

  1. Atomic locking and isolation over the entire collection
  2. Fine-grained serialization of deltas
1. Atomic locking and isolation over the entire collection

This allows the entire AtomicMap to be locked when making changes even to certain entries within the map, and also isolates the map for safe reading (see IsolationLevel while concurrent writes may be going on.

2. Fine-grained serialization of deltas

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 Delta instances would work just as well, and typically be much smaller and hence faster to serialize and transport.

Applications requiring either or both of the characteristics described above are encouraged to use AtomicMaps with Infinispan, however the real benefit is often only seen where a combination of both characteristics are required.


AtomicMaps should be constructed and "registered" with Infinispan using the AtomicMapLookup helper. This helper ensures threadsafe construction and registration of AtomicMap instances in Infinispan's data container. E.g.:
AtomicMap<String, Integer> map = AtomicMapLookup.getAtomicMap(cache, "my_atomic_map_key");

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 to Map.

Manik Surtani
See Also:
DeltaAware, Delta, AtomicHashMap, AtomicMapLookup

Nested Class Summary
Nested classes/interfaces inherited from interface java.util.Map
Method Summary
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values

Google Analytics

Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.