A ReplicatedMap is a map like data structure with non-strong consistency (so-called eventually consistent) and values are locally stored on every node of the cluster. When accessing values, due to the eventually consistency, it is possible to read staled data since replication is not handled in a synchronous way.
Whenever a value is written asynchronously the new value will be internally distributed to all existing cluster members and eventually every node will have the new value and the cluster again is in a consistent state.
When a new node joins the cluster the new node initially will request existing values from older nodes and replicate those locally.
@param < K> the type of keys maintained by this map @param < V> the type of mapped values @since 3.2replicate(Object,boolean)
- replicates only the object that belongs to the keyreplicate(boolean)
- Scans the entire map for changes and replicates databoolean
value in the replicate
method used to decide whether to only replicate objects that implement the ReplicatedMapEntry
interface or to replicate all objects. If an object doesn't implement the ReplicatedMapEntry
interface each time the object gets replicated the entire object gets serialized, hence a call to replicate(true)
will replicate all objects in this map that are using this node as primary. breakdown()
or finalize()
when you are done with the map to avoid memory leaks.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|