Package org.apache.curator.x.discovery
Interface ServiceProvider<T>
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
ServiceProviderImpl
The main API for Discovery. This class is essentially a facade over a
ProviderStrategy
paired with an InstanceProvider-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the provider.Return the current available set of instances IMPORTANT: users should not hold on to the instance returned.Return an instance for a single use.voidnoteError(ServiceInstance<T> instance) Take note of an error connecting to the given instance.voidstart()The provider must be started before use
-
Method Details
-
start
The provider must be started before use- Throws:
Exception- any errors
-
getInstance
Return an instance for a single use. IMPORTANT: users should not hold on to the instance returned. They should always get a fresh instance.- Returns:
- the instance to use
- Throws:
Exception- any errors
-
getAllInstances
Return the current available set of instances IMPORTANT: users should not hold on to the instance returned. They should always get a fresh list.- Returns:
- all known instances
- Throws:
Exception- any errors
-
noteError
Take note of an error connecting to the given instance. The instance will potentially be marked as "down" depending on theDownInstancePolicy.- Parameters:
instance- instance that had an error
-
close
Close the provider. Note: it's the provider's responsibility to close any caches it manages- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-