|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.curator.framework.recipes.cache.NodeCache
public class NodeCache
A utility that attempts to keep the data from a node locally cached. This class will watch the node, respond to update/create/delete events, pull down the data, etc. You can register a listener that will get notified when changes occur.
IMPORTANT - it's not possible to stay transactionally in sync. Users of this class must be prepared for false-positives and false-negatives. Additionally, always use the version number when updating data to avoid overwriting another process' change.
| Constructor Summary | |
|---|---|
NodeCache(org.apache.curator.framework.CuratorFramework client,
String path)
|
|
NodeCache(org.apache.curator.framework.CuratorFramework client,
String path,
boolean dataIsCompressed)
|
|
| Method Summary | |
|---|---|
void |
close()
|
ChildData |
getCurrentData()
Return the current data. |
org.apache.curator.framework.listen.ListenerContainer<NodeCacheListener> |
getListenable()
Return the cache listenable |
void |
rebuild()
NOTE: this is a BLOCKING method. |
void |
start()
Start the cache. |
void |
start(boolean buildInitial)
Same as start() but gives the option of doing an initial build |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NodeCache(org.apache.curator.framework.CuratorFramework client,
String path)
client - curztor clientpath - the full path to the node to cache
public NodeCache(org.apache.curator.framework.CuratorFramework client,
String path,
boolean dataIsCompressed)
client - curztor clientpath - the full path to the node to cachedataIsCompressed - if true, data in the path is compressed| Method Detail |
|---|
public void start()
throws Exception
Exception - errors
public void start(boolean buildInitial)
throws Exception
start() but gives the option of doing an initial build
buildInitial - if true, rebuild() will be called before this method
returns in order to get an initial view of the node
Exception - errors
public void close()
throws IOException
close in interface CloseableIOExceptionpublic org.apache.curator.framework.listen.ListenerContainer<NodeCacheListener> getListenable()
public void rebuild()
throws Exception
Exception - errorspublic ChildData getCurrentData()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||