Package org.apache.curator.x.discovery
Interface ServiceDiscovery<T>
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
ServiceDiscoveryImpl
-
Method Summary
Modifier and TypeMethodDescriptionqueryForInstance
(String name, String id) Return a service instance POJOqueryForInstances
(String name) Return all known instances for the given serviceReturn the names of all known servicesvoid
registerService
(ServiceInstance<T> service) Register/re-register a serviceAllocate a new service cache builder.Allocate a new builder.void
start()
The discovery must be started before usevoid
unregisterService
(ServiceInstance<T> service) Unregister/remove a service instancevoid
updateService
(ServiceInstance<T> service) Update a service
-
Method Details
-
start
The discovery must be started before use- Throws:
Exception
- errors
-
registerService
Register/re-register a service- Parameters:
service
- service to add- Throws:
Exception
- errors
-
updateService
Update a service- Parameters:
service
- service to update- Throws:
Exception
- errors
-
unregisterService
Unregister/remove a service instance- Parameters:
service
- the service- Throws:
Exception
- errors
-
serviceCacheBuilder
ServiceCacheBuilder<T> serviceCacheBuilder()Allocate a new service cache builder. The refresh padding is defaulted to 1 second.- Returns:
- new cache builder
-
queryForNames
Return the names of all known services- Returns:
- list of service names
- Throws:
Exception
- errors
-
queryForInstances
Return all known instances for the given service- Parameters:
name
- name of the service- Returns:
- list of instances (or an empty list)
- Throws:
Exception
- errors
-
queryForInstance
Return a service instance POJO- Parameters:
name
- name of the serviceid
- ID of the instance- Returns:
- the instance or
null
if not found - Throws:
Exception
- errors
-
serviceProviderBuilder
ServiceProviderBuilder<T> serviceProviderBuilder()Allocate a new builder.ServiceProviderBuilder.providerStrategy(org.apache.curator.x.discovery.ProviderStrategy<T>)
is set toRoundRobinStrategy
- Returns:
- the builder
-