Class NodeCache
java.lang.Object
org.apache.curator.framework.recipes.cache.NodeCache
- All Implemented Interfaces:
Closeable
,AutoCloseable
Deprecated.
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
ConstructorDescriptionNodeCache
(CuratorFramework client, String path) Deprecated.NodeCache
(CuratorFramework client, String path, boolean dataIsCompressed) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Deprecated.Deprecated.Deprecated.Return the current data.Deprecated.Return the cache listenablegetPath()
Deprecated.Return the path this cache is watchingprotected void
Deprecated.Default behavior is just to log the exceptionvoid
rebuild()
Deprecated.NOTE: this is a BLOCKING method.void
start()
Deprecated.Start the cache.void
start
(boolean buildInitial) Deprecated.Same asstart()
but gives the option of doing an initial build
-
Constructor Details
-
NodeCache
Deprecated.- Parameters:
client
- curator clientpath
- the full path to the node to cache
-
NodeCache
Deprecated.- Parameters:
client
- curator clientpath
- the full path to the node to cachedataIsCompressed
- if true, data in the path is compressed
-
-
Method Details
-
getClient
Deprecated. -
start
Deprecated.Start the cache. The cache is not started automatically. You must call this method.- Throws:
Exception
- errors
-
start
Deprecated.Same asstart()
but gives the option of doing an initial build -
close
Deprecated.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
getListenable
Deprecated.Return the cache listenable- Returns:
- listenable
-
rebuild
Deprecated.NOTE: this is a BLOCKING method. Completely rebuild the internal cache by querying for all needed data WITHOUT generating any events to send to listeners.- Throws:
Exception
- errors
-
getCurrentData
Deprecated.Return the current data. There are no guarantees of accuracy. This is merely the most recent view of the data. If the node does not exist, this returns null- Returns:
- data or null
-
getPath
Deprecated.Return the path this cache is watching- Returns:
- path
-
handleException
Deprecated.Default behavior is just to log the exception- Parameters:
e
- the exception
-
CuratorCache