Package org.apache.solr.cloud
Class DistributedMap
java.lang.Object
org.apache.solr.cloud.DistributedMap
- Direct Known Subclasses:
SizeLimitedDistributedMap
A distributed map. This supports basic map functions e.g. get, put, contains for interaction with
zk which don't have to be ordered i.e. DistributedQueue.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDistributedMap(org.apache.solr.common.cloud.SolrZkClient zookeeper, String dir) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Helper method to clear all child nodes for a parent node.booleanbyte[]keys()Returns the keys of all the elements in the mapvoidbooleanputIfAbsent(String trackingId, byte[] data) Puts an element in the map only if there isn't one with the same trackingId alreadybooleanreturn true if the znode was successfully deleted false if the node didn't exist and therefore not deleted exception an exception occurred while deletingintsize()
-
Field Details
-
dir
-
zookeeper
protected org.apache.solr.common.cloud.SolrZkClient zookeeper -
PREFIX
- See Also:
-
-
Constructor Details
-
DistributedMap
-
-
Method Details
-
put
public void put(String trackingId, byte[] data) throws org.apache.zookeeper.KeeperException, InterruptedException - Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
putIfAbsent
public boolean putIfAbsent(String trackingId, byte[] data) throws org.apache.zookeeper.KeeperException, InterruptedException Puts an element in the map only if there isn't one with the same trackingId already- Returns:
- True if the element was added. False if it wasn't (because the key already exists)
- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
get
public byte[] get(String trackingId) throws org.apache.zookeeper.KeeperException, InterruptedException - Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
contains
public boolean contains(String trackingId) throws org.apache.zookeeper.KeeperException, InterruptedException - Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
size
- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
remove
public boolean remove(String trackingId) throws org.apache.zookeeper.KeeperException, InterruptedException return true if the znode was successfully deleted false if the node didn't exist and therefore not deleted exception an exception occurred while deleting- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
clear
Helper method to clear all child nodes for a parent node.- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
keys
Returns the keys of all the elements in the map- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-