CuratorCache@Deprecated public class NodeCache extends Object implements Closeable
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 and Description |
|---|
NodeCache(org.apache.curator.framework.CuratorFramework client,
String path)
Deprecated.
|
NodeCache(org.apache.curator.framework.CuratorFramework client,
String path,
boolean dataIsCompressed)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Deprecated.
|
org.apache.curator.framework.CuratorFramework |
getClient()
Deprecated.
|
ChildData |
getCurrentData()
Deprecated.
Return the current data.
|
org.apache.curator.framework.listen.Listenable<NodeCacheListener> |
getListenable()
Deprecated.
Return the cache listenable
|
String |
getPath()
Deprecated.
Return the path this cache is watching
|
protected void |
handleException(Throwable e)
Deprecated.
Default behavior is just to log the exception
|
void |
rebuild()
Deprecated.
NOTE: this is a BLOCKING method.
|
void |
start()
Deprecated.
Start the cache.
|
void |
start(boolean buildInitial)
Deprecated.
Same as
start() but gives the option of doing an initial build |
public NodeCache(org.apache.curator.framework.CuratorFramework client,
String path)
client - curator clientpath - the full path to the node to cachepublic NodeCache(org.apache.curator.framework.CuratorFramework client,
String path,
boolean dataIsCompressed)
client - curator clientpath - the full path to the node to cachedataIsCompressed - if true, data in the path is compressedpublic org.apache.curator.framework.CuratorFramework getClient()
public void start()
throws Exception
Exception - errorspublic void start(boolean buildInitial)
throws Exception
start() but gives the option of doing an initial buildpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic org.apache.curator.framework.listen.Listenable<NodeCacheListener> getListenable()
public void rebuild()
throws Exception
Exception - errorspublic ChildData getCurrentData()
public String getPath()
protected void handleException(Throwable e)
e - the exceptionCopyright © 2011–2020 The Apache Software Foundation. All rights reserved.