Package org.apache.zookeeper.server
Class NodeHashMapImpl
- java.lang.Object
- 
- org.apache.zookeeper.server.NodeHashMapImpl
 
- 
- All Implemented Interfaces:
- NodeHashMap
 
 public class NodeHashMapImpl extends Object implements NodeHashMap a simple wrapper to ConcurrentHashMap that recalculates a digest after each mutation.
- 
- 
Constructor SummaryConstructors Constructor Description NodeHashMapImpl(DigestCalculator digestCalculator)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear all the items stored inside this map.Set<Map.Entry<String,DataNode>>entrySet()Return all the entries inside this map.DataNodeget(String path)Return the data node associated with the path.longgetDigest()Return the digest value.voidpostChange(String path, DataNode node)Called after making the changes on the node, which will update the digest.voidpreChange(String path, DataNode node)Called before we made the change on the node, which will clear the digest associated with it.DataNodeput(String path, DataNode node)Add the node into the map and update the digest with the new node.DataNodeputWithoutDigest(String path, DataNode node)Add the node into the map without update the digest.DataNoderemove(String path)Remove the path from the internal nodes map.intsize()Return the size of the nodes stored in this map.
 
- 
- 
- 
Constructor Detail- 
NodeHashMapImplpublic NodeHashMapImpl(DigestCalculator digestCalculator) 
 
- 
 - 
Method Detail- 
putpublic DataNode put(String path, DataNode node) Description copied from interface:NodeHashMapAdd the node into the map and update the digest with the new node.- Specified by:
- putin interface- NodeHashMap
- Parameters:
- path- the path of the node
- node- the actual node associated with this path
 
 - 
putWithoutDigestpublic DataNode putWithoutDigest(String path, DataNode node) Description copied from interface:NodeHashMapAdd the node into the map without update the digest.- Specified by:
- putWithoutDigestin interface- NodeHashMap
- Parameters:
- path- the path of the node
- node- the actual node associated with this path
 
 - 
getpublic DataNode get(String path) Description copied from interface:NodeHashMapReturn the data node associated with the path.- Specified by:
- getin interface- NodeHashMap
- Parameters:
- path- the path to read from
 
 - 
removepublic DataNode remove(String path) Description copied from interface:NodeHashMapRemove the path from the internal nodes map.- Specified by:
- removein interface- NodeHashMap
- Parameters:
- path- the path to remove
- Returns:
- the node being removed
 
 - 
entrySetpublic Set<Map.Entry<String,DataNode>> entrySet() Description copied from interface:NodeHashMapReturn all the entries inside this map.- Specified by:
- entrySetin interface- NodeHashMap
 
 - 
clearpublic void clear() Description copied from interface:NodeHashMapClear all the items stored inside this map.- Specified by:
- clearin interface- NodeHashMap
 
 - 
sizepublic int size() Description copied from interface:NodeHashMapReturn the size of the nodes stored in this map.- Specified by:
- sizein interface- NodeHashMap
 
 - 
preChangepublic void preChange(String path, DataNode node) Description copied from interface:NodeHashMapCalled before we made the change on the node, which will clear the digest associated with it.- Specified by:
- preChangein interface- NodeHashMap
- Parameters:
- path- the path being changed
- node- the node associated with the path
 
 - 
postChangepublic void postChange(String path, DataNode node) Description copied from interface:NodeHashMapCalled after making the changes on the node, which will update the digest.- Specified by:
- postChangein interface- NodeHashMap
- Parameters:
- path- the path being changed
- node- the node associated with the path
 
 - 
getDigestpublic long getDigest() Description copied from interface:NodeHashMapReturn the digest value.- Specified by:
- getDigestin interface- NodeHashMap
 
 
- 
 
-