|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.netflix.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(com.netflix.curator.framework.CuratorFramework client,
java.lang.String path)
|
|
NodeCache(com.netflix.curator.framework.CuratorFramework client,
java.lang.String path,
boolean dataIsCompressed)
|
|
| Method Summary | |
|---|---|
void |
close()
|
ChildData |
getCurrentData()
Return the current data. |
com.netflix.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(com.netflix.curator.framework.CuratorFramework client,
java.lang.String path)
client - curztor clientpath - the full path to the node to cache
public NodeCache(com.netflix.curator.framework.CuratorFramework client,
java.lang.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 java.lang.Exception
java.lang.Exception - errors
public void start(boolean buildInitial)
throws java.lang.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
java.lang.Exception - errors
public void close()
throws java.io.IOException
close in interface java.io.Closeablejava.io.IOExceptionpublic com.netflix.curator.framework.listen.ListenerContainer<NodeCacheListener> getListenable()
public void rebuild()
throws java.lang.Exception
java.lang.Exception - errorspublic ChildData getCurrentData()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||