org.apache.accumulo.fate.zookeeper
Class ZooCache

java.lang.Object
  extended by org.apache.accumulo.fate.zookeeper.ZooCache

public class ZooCache
extends Object

A cache for values stored in ZooKeeper. Values are kept up to date as they change.


Constructor Summary
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, org.apache.zookeeper.Watcher watcher)
          Creates a new cache.
 
Method Summary
 void clear()
          Clears this cache.
 void clear(String zPath)
          Clears this cache of all information about nodes rooted at the given path.
 byte[] get(String zPath)
          Gets data at the given path.
 byte[] get(String zPath, org.apache.zookeeper.data.Stat stat)
          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.
static ZooCache getInstance(String zooKeepers, int sessionTimeout)
          Deprecated. Use ZooCacheFactory instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZooCache

public ZooCache(String zooKeepers,
                int sessionTimeout)
Creates a new cache.

Parameters:
zooKeepers - comma-separated list of ZooKeeper host[:port]s
sessionTimeout - ZooKeeper session timeout

ZooCache

public ZooCache(String zooKeepers,
                int sessionTimeout,
                org.apache.zookeeper.Watcher watcher)
Creates a new cache. The given watcher is called whenever a watched node changes.

Parameters:
zooKeepers - comma-separated list of ZooKeeper host[:port]s
sessionTimeout - ZooKeeper session timeout
watcher - watcher object

ZooCache

public ZooCache(ZooReader reader,
                org.apache.zookeeper.Watcher watcher)
Creates a new cache. The given watcher is called whenever a watched node changes.

Parameters:
reader - ZooKeeper reader
watcher - watcher object
Method Detail

getChildren

public List<String> getChildren(String zPath)
Gets the children of the given node. A watch is established by this call.

Parameters:
zPath - path of node
Returns:
children list, or null if node has no children or does not exist

get

public byte[] get(String zPath)
Gets data at the given path. Status information is not returned. A watch is established by this call.

Parameters:
zPath - path to get
Returns:
path data, or null if non-existent

get

public byte[] get(String zPath,
                  org.apache.zookeeper.data.Stat stat)
Gets data at the given path, filling status information into the given Stat object. A watch is established by this call.

Parameters:
zPath - path to get
stat - status object to populate
Returns:
path data, or null if non-existent

clear

public void clear()
Clears this cache.


clear

public void clear(String zPath)
Clears this cache of all information about nodes rooted at the given path.

Parameters:
zPath - path of top node

getInstance

@Deprecated
public static ZooCache getInstance(String zooKeepers,
                                              int sessionTimeout)
Deprecated. Use ZooCacheFactory instead.



Copyright © 2015 Apache Accumulo Project. All rights reserved.