Package org.apache.zookeeper.server
Class NodeHashMapImpl
java.lang.Object
org.apache.zookeeper.server.NodeHashMapImpl
- All Implemented Interfaces:
NodeHashMap
a simple wrapper to ConcurrentHashMap that recalculates a digest after
each mutation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear all the items stored inside this map.entrySet()Return all the entries inside this map.Return the data node associated with the path.longReturn the digest value.voidpostChange(String path, DataNode node) Called after making the changes on the node, which will update the digest.voidCalled before we made the change on the node, which will clear the digest associated with it.Add the node into the map and update the digest with the new node.putWithoutDigest(String path, DataNode node) Add the node into the map without update the digest.Remove the path from the internal nodes map.intsize()Return the size of the nodes stored in this map.
-
Constructor Details
-
NodeHashMapImpl
-
-
Method Details
-
put
Description copied from interface:NodeHashMapAdd the node into the map and update the digest with the new node.- Specified by:
putin interfaceNodeHashMap- Parameters:
path- the path of the nodenode- the actual node associated with this path
-
putWithoutDigest
Description copied from interface:NodeHashMapAdd the node into the map without update the digest.- Specified by:
putWithoutDigestin interfaceNodeHashMap- Parameters:
path- the path of the nodenode- the actual node associated with this path
-
get
Description copied from interface:NodeHashMapReturn the data node associated with the path.- Specified by:
getin interfaceNodeHashMap- Parameters:
path- the path to read from
-
remove
Description copied from interface:NodeHashMapRemove the path from the internal nodes map.- Specified by:
removein interfaceNodeHashMap- Parameters:
path- the path to remove- Returns:
- the node being removed
-
entrySet
Description copied from interface:NodeHashMapReturn all the entries inside this map.- Specified by:
entrySetin interfaceNodeHashMap
-
clear
public void clear()Description copied from interface:NodeHashMapClear all the items stored inside this map.- Specified by:
clearin interfaceNodeHashMap
-
size
public int size()Description copied from interface:NodeHashMapReturn the size of the nodes stored in this map.- Specified by:
sizein interfaceNodeHashMap
-
preChange
Description copied from interface:NodeHashMapCalled before we made the change on the node, which will clear the digest associated with it.- Specified by:
preChangein interfaceNodeHashMap- Parameters:
path- the path being changednode- the node associated with the path
-
postChange
Description copied from interface:NodeHashMapCalled after making the changes on the node, which will update the digest.- Specified by:
postChangein interfaceNodeHashMap- Parameters:
path- the path being changednode- the node associated with the path
-
getDigest
public long getDigest()Description copied from interface:NodeHashMapReturn the digest value.- Specified by:
getDigestin interfaceNodeHashMap
-