|
SMILA 1.0 API documentation | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.smila.zookeeper.ZkConcurrentMap
public class ZkConcurrentMap
Provides a map view to the zookeeper structure below an existing root node path. Additionally it has methods to "merge" values with existing ones (e.g. add() to sum ints) Methods are similar (but not equal) to ConcurrentHashMap. ZkConcurrentMap also uses no locks.
| Constructor Summary | |
|---|---|
ZkConcurrentMap(ZkConnection zk,
java.lang.String rootNodePath)
|
|
ZkConcurrentMap(ZooKeeperService service,
java.lang.String rootNodePath)
|
|
| Method Summary | |
|---|---|
java.lang.Integer |
add(java.lang.String key,
int value)
add value to old value of given key. |
void |
clear()
Removes all mappings from this map. |
boolean |
containsKey(java.lang.String key)
|
java.lang.Integer |
decIfGreaterThan(java.lang.String key,
long min)
dec value of given key, but only if value is not negative and value > min. |
java.lang.Integer |
getInt(java.lang.String key)
|
java.lang.String |
getString(java.lang.String key)
|
java.lang.Integer |
getVersion(java.lang.String key)
revision of the key node. |
java.lang.Integer |
incIfLessThan(java.lang.String key,
long max)
inc value of given key, but only if value is not negative and value < max. |
java.util.Set<java.lang.String> |
keySet()
|
boolean |
put(java.lang.String key,
java.lang.String value)
set value for given key. |
java.lang.String |
putIfAbsent(java.lang.String key,
java.lang.String value)
set value for given key if key doesn't exist yet. |
void |
remove(java.lang.String key)
Remove given key / value mapping. |
boolean |
replace(java.lang.String key,
java.lang.String oldValue,
java.lang.String newValue)
Set new value for given key if key exists and has given old value. |
java.lang.Integer |
replaceAndGetVersion(java.lang.String key,
java.lang.String oldValue,
java.lang.String newValue)
Set new value for given key if key exists and has given old value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ZkConcurrentMap(ZooKeeperService service,
java.lang.String rootNodePath)
service - the zookeeper servicerootNodePath - the existing(!) zookeeper root node path from where to start the map view.
public ZkConcurrentMap(ZkConnection zk,
java.lang.String rootNodePath)
zk - shared ZooKeeper connectionrootNodePath - the existing(!) zookeeper root node path from where to start the map view.
java.lang.IllegalArgumentException - if root node doesn't exist in zookeeper| Method Detail |
|---|
public boolean put(java.lang.String key,
java.lang.String value)
key - not allowed to be 'null'value - not allowed to be 'null'
public java.lang.String putIfAbsent(java.lang.String key,
java.lang.String value)
key - not allowed to be 'null'value - not allowed to be 'null'
public boolean replace(java.lang.String key,
java.lang.String oldValue,
java.lang.String newValue)
key - the key, not allowed to be 'null'oldValue - the old value, not allowed to be 'null'newValue - the new value, not allowed to be 'null'
public java.lang.Integer replaceAndGetVersion(java.lang.String key,
java.lang.String oldValue,
java.lang.String newValue)
key - the key, not allowed to be 'null'oldValue - the old value, not allowed to be 'null'newValue - the new value, not allowed to be 'null'
public java.lang.String getString(java.lang.String key)
key - the key, not allowed to be 'null'
public java.lang.Integer getInt(java.lang.String key)
key - the key, not allowed to be 'null'
public java.lang.Integer getVersion(java.lang.String key)
key - the key, not allowed to be 'null'
public void remove(java.lang.String key)
key - the key, not allowed to be 'null'
public java.lang.Integer add(java.lang.String key,
int value)
key - the key, not allowed to be 'null'value - the value to add
public java.util.Set<java.lang.String> keySet()
public boolean containsKey(java.lang.String key)
public void clear()
public java.lang.Integer incIfLessThan(java.lang.String key,
long max)
key - the key, not allowed to be 'null'max - the maximum value
public java.lang.Integer decIfGreaterThan(java.lang.String key,
long min)
key - the key, not allowed to be 'null'min - the minimum value
|
SMILA 1.0 API documentation | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||