Package org.apache.curator.x.discovery
Interface ServiceCache<T>
- All Superinterfaces:
AutoCloseable
,Closeable
,InstanceProvider<T>
,Listenable<ServiceCacheListener>
- All Known Implementing Classes:
ServiceCacheImpl
public interface ServiceCache<T>
extends Closeable, Listenable<ServiceCacheListener>, InstanceProvider<T>
-
Method Summary
Modifier and TypeMethodDescriptionReturn the current list of instances.void
start()
The cache must be started before useMethods inherited from interface org.apache.curator.framework.listen.Listenable
addListener, addListener, removeListener
-
Method Details
-
getInstances
List<ServiceInstance<T>> getInstances()Return 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:
getInstances
in interfaceInstanceProvider<T>
- Returns:
- the list
-
start
The cache must be started before use- Throws:
Exception
- errors
-
startImmediate
- Throws:
Exception
-