public class ZooCache extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ZooCache.ZcStat |
Constructor and Description |
---|
ZooCache(String zooKeepers,
int sessionTimeout)
Creates a new cache.
|
ZooCache(String zooKeepers,
int sessionTimeout,
org.apache.zookeeper.Watcher watcher)
Creates a new cache.
|
ZooCache(ZooReader reader) |
ZooCache(ZooReader reader,
org.apache.zookeeper.Watcher watcher)
Creates a new cache.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears this cache.
|
void |
clear(String zPath)
Clears this cache of all information about nodes rooted at the given path.
|
protected void |
copyStats(ZooCache.ZcStat userStat,
ZooCache.ZcStat cachedStat)
Helper method to copy stats from the cached stat into userStat
|
byte[] |
get(String zPath)
Gets data at the given path.
|
byte[] |
get(String zPath,
ZooCache.ZcStat status)
Gets data at the given path, filling status information into the given
Stat
object. |
List<String> |
getChildren(String zPath)
Gets the children of the given node.
|
long |
getUpdateCount()
Returns a monotonically increasing count of the number of time the cache was updated.
|
public ZooCache(String zooKeepers, int sessionTimeout)
zooKeepers
- comma-separated list of ZooKeeper host[:port]ssessionTimeout
- ZooKeeper session timeoutpublic ZooCache(String zooKeepers, int sessionTimeout, org.apache.zookeeper.Watcher watcher)
zooKeepers
- comma-separated list of ZooKeeper host[:port]ssessionTimeout
- ZooKeeper session timeoutwatcher
- watcher objectpublic ZooCache(ZooReader reader)
public ZooCache(ZooReader reader, org.apache.zookeeper.Watcher watcher)
reader
- ZooKeeper readerwatcher
- watcher objectpublic List<String> getChildren(String zPath)
zPath
- path of nodepublic byte[] get(String zPath)
zPath
- path to getpublic byte[] get(String zPath, ZooCache.ZcStat status)
Stat
object. A watch is established by this call.zPath
- path to getstatus
- status object to populateprotected void copyStats(ZooCache.ZcStat userStat, ZooCache.ZcStat cachedStat)
userStat
- user Stat objectcachedStat
- cached statistic, that is or will be cachedpublic void clear()
public long getUpdateCount()
public void clear(String zPath)
zPath
- path of top nodeCopyright © 2011–2018 The Apache Software Foundation. All rights reserved.