Class ServiceCacheImpl<T>
java.lang.Object
org.apache.curator.x.discovery.details.ServiceCacheImpl<T>
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.curator.framework.listen.Listenable<ServiceCacheListener>,org.apache.curator.framework.recipes.cache.PathChildrenCacheListener,InstanceProvider<T>,ServiceCache<T>
public class ServiceCacheImpl<T>
extends Object
implements ServiceCache<T>, org.apache.curator.framework.recipes.cache.PathChildrenCacheListener
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(ServiceCacheListener listener) voidaddListener(ServiceCacheListener listener, Executor executor) voidchildEvent(org.apache.curator.framework.CuratorFramework client, org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent event) voidclose()Return the current list of instances.voidremoveListener(ServiceCacheListener listener) voidstart()The cache must be started before use
-
Method Details
-
getInstances
Description copied from interface:ServiceCacheReturn the current list of instances. NOTE: there is no guarantee of freshness. This is merely the last known list of instances. However, the list is updated via a ZooKeeper watcher so it should be fresh within a window of a second or two.- Specified by:
getInstancesin interfaceInstanceProvider<T>- Specified by:
getInstancesin interfaceServiceCache<T>- Returns:
- the list
-
start
Description copied from interface:ServiceCacheThe cache must be started before use- Specified by:
startin interfaceServiceCache<T>- Throws:
Exception- errors
-
startImmediate
- Specified by:
startImmediatein interfaceServiceCache<T>- Throws:
Exception
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
addListener
- Specified by:
addListenerin interfaceorg.apache.curator.framework.listen.Listenable<T>
-
addListener
- Specified by:
addListenerin interfaceorg.apache.curator.framework.listen.Listenable<T>
-
removeListener
- Specified by:
removeListenerin interfaceorg.apache.curator.framework.listen.Listenable<T>
-
childEvent
public void childEvent(org.apache.curator.framework.CuratorFramework client, org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent event) - Specified by:
childEventin interfaceorg.apache.curator.framework.recipes.cache.PathChildrenCacheListener
-