T - public abstract class ZooKeeperCache extends Object implements org.apache.zookeeper.Watcher
ZooKeeperCache.Deserializer argument.| Modifier and Type | Class and Description |
|---|---|
static interface |
ZooKeeperCache.CacheUpdater<T> |
static interface |
ZooKeeperCache.Deserializer<T> |
| Modifier and Type | Field and Description |
|---|---|
protected com.google.common.cache.Cache<String,Set<String>> |
childrenCache |
protected com.github.benmanes.caffeine.cache.AsyncLoadingCache<String,Map.Entry<Object,org.apache.zookeeper.data.Stat>> |
dataCache |
protected com.google.common.cache.Cache<String,Boolean> |
existsCache |
static String |
ZK_CACHE_INSTANCE |
protected AtomicReference<org.apache.zookeeper.ZooKeeper> |
zkSession |
| Constructor and Description |
|---|
ZooKeeperCache(org.apache.zookeeper.ZooKeeper zkSession,
int zkOperationTimeoutSeconds) |
ZooKeeperCache(org.apache.zookeeper.ZooKeeper zkSession,
int zkOperationTimeoutSeconds,
org.apache.bookkeeper.common.util.OrderedExecutor executor) |
| Modifier and Type | Method and Description |
|---|---|
void |
asyncInvalidate(String path) |
boolean |
exists(String path)
Returns if the node at the given path exists in the cache
|
Set<String> |
getChildren(String path)
Simple ZooKeeperChildrenCache use this method to invalidate cache entry on watch event w/o automatic re-loading
|
Set<String> |
getChildren(String path,
org.apache.zookeeper.Watcher watcher)
ZooKeeperChildrenCache implementing automatic re-loading on update use this method by passing in a different
Watcher object to reload cache entry
|
Set<String> |
getChildrenIfPresent(String path) |
<T> Optional<Map.Entry<T,org.apache.zookeeper.data.Stat>> |
getData(String path,
org.apache.zookeeper.Watcher watcher,
ZooKeeperCache.Deserializer<T> deserializer)
Cache that implements automatic reloading on update will pass a different Watcher object to reload cache entry
automatically
|
<T> Optional<T> |
getData(String path,
ZooKeeperCache.Deserializer<T> deserializer)
Simple ZooKeeperCache use this method to invalidate the cache entry on watch event w/o automatic reloading the
cache
|
<T> CompletableFuture<Optional<Map.Entry<T,org.apache.zookeeper.data.Stat>>> |
getDataAsync(String path,
org.apache.zookeeper.Watcher watcher,
ZooKeeperCache.Deserializer<T> deserializer) |
<T> CompletableFuture<Optional<T>> |
getDataAsync(String path,
ZooKeeperCache.Deserializer<T> deserializer) |
<T> T |
getDataIfPresent(String path) |
<T> Optional<Map.Entry<T,org.apache.zookeeper.data.Stat>> |
getEntry(String path,
ZooKeeperCache.Deserializer<T> deserializer) |
<T> CompletableFuture<Optional<Map.Entry<T,org.apache.zookeeper.data.Stat>>> |
getEntryAsync(String path,
ZooKeeperCache.Deserializer<T> deserializer) |
int |
getZkOperationTimeoutSeconds() |
org.apache.zookeeper.ZooKeeper |
getZooKeeper() |
void |
invalidate(String path) |
void |
invalidateAll() |
void |
invalidateAllChildren() |
void |
invalidateAllData() |
void |
invalidateChildren(String path) |
void |
invalidateData(String path) |
void |
invalidateRoot(String root) |
void |
process(org.apache.zookeeper.WatchedEvent event) |
<T> void |
process(org.apache.zookeeper.WatchedEvent event,
ZooKeeperCache.CacheUpdater<T> updater) |
void |
stop() |
public static final String ZK_CACHE_INSTANCE
protected final com.github.benmanes.caffeine.cache.AsyncLoadingCache<String,Map.Entry<Object,org.apache.zookeeper.data.Stat>> dataCache
protected AtomicReference<org.apache.zookeeper.ZooKeeper> zkSession
public ZooKeeperCache(org.apache.zookeeper.ZooKeeper zkSession,
int zkOperationTimeoutSeconds,
org.apache.bookkeeper.common.util.OrderedExecutor executor)
public ZooKeeperCache(org.apache.zookeeper.ZooKeeper zkSession,
int zkOperationTimeoutSeconds)
public org.apache.zookeeper.ZooKeeper getZooKeeper()
public <T> void process(org.apache.zookeeper.WatchedEvent event,
ZooKeeperCache.CacheUpdater<T> updater)
public void invalidateAll()
public void invalidateAllData()
public void invalidateAllChildren()
public void invalidateData(String path)
public void invalidateChildren(String path)
public void asyncInvalidate(String path)
public int getZkOperationTimeoutSeconds()
public void invalidate(String path)
public boolean exists(String path) throws org.apache.zookeeper.KeeperException, InterruptedException
path - path of the nodeorg.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic <T> Optional<T> getData(String path, ZooKeeperCache.Deserializer<T> deserializer) throws Exception
path - deserializer - stat - Exceptionpublic <T> Optional<Map.Entry<T,org.apache.zookeeper.data.Stat>> getEntry(String path, ZooKeeperCache.Deserializer<T> deserializer) throws Exception
Exceptionpublic <T> CompletableFuture<Optional<Map.Entry<T,org.apache.zookeeper.data.Stat>>> getEntryAsync(String path, ZooKeeperCache.Deserializer<T> deserializer)
public <T> CompletableFuture<Optional<T>> getDataAsync(String path, ZooKeeperCache.Deserializer<T> deserializer)
public <T> Optional<Map.Entry<T,org.apache.zookeeper.data.Stat>> getData(String path, org.apache.zookeeper.Watcher watcher, ZooKeeperCache.Deserializer<T> deserializer) throws Exception
path - watcher - deserializer - stat - Exceptionpublic <T> CompletableFuture<Optional<Map.Entry<T,org.apache.zookeeper.data.Stat>>> getDataAsync(String path, org.apache.zookeeper.Watcher watcher, ZooKeeperCache.Deserializer<T> deserializer)
public Set<String> getChildren(String path) throws org.apache.zookeeper.KeeperException, InterruptedException
path - org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic Set<String> getChildren(String path, org.apache.zookeeper.Watcher watcher) throws org.apache.zookeeper.KeeperException, InterruptedException
path - watcher - org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic <T> T getDataIfPresent(String path)
public void process(org.apache.zookeeper.WatchedEvent event)
process in interface org.apache.zookeeper.Watcherpublic void invalidateRoot(String root)
public void stop()
Copyright © 2017–2019 Apache Software Foundation. All rights reserved.