T - The type of resource that is distributed to all participants in the cache.public class SharedResourceCache<T> extends com.google.common.cache.AbstractLoadingCache<String,T>
| Constructor and Description |
|---|
SharedResourceCache(ZKClient zookeeper,
Codec<T> codec,
String parentZnode,
List<org.apache.zookeeper.data.ACL> znodeACL) |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(ResourceListener<T> listener)
Adds a
ResourceListener to be notified of cache updates. |
boolean |
equals(Object object) |
T |
get(String key) |
T |
getIfPresent(Object key) |
Iterable<T> |
getResources()
Returns a view of all currently set resources.
|
void |
init() |
void |
put(String name,
T instance) |
void |
putAll(Map<? extends String,? extends T> map) |
void |
remove(Object key)
Removes a resource from the shared cache.
|
boolean |
removeListener(ResourceListener<T> listener)
Removes a previously registered listener from further notifications.
|
long |
size() |
apply, getAll, getUnchecked, refreshasMap, cleanUp, get, getAllPresent, invalidate, invalidateAll, invalidateAll, statspublic void init()
throws InterruptedException
InterruptedExceptionpublic void addListener(ResourceListener<T> listener)
ResourceListener to be notified of cache updates.listener - the listener to be invokedpublic boolean removeListener(ResourceListener<T> listener)
listener - the listener to removepublic void remove(Object key)
key - the name of the resource to removepublic long size()
Copyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.