Package org.apache.curator.x.discovery
Interface ServiceProviderBuilder<T>
public interface ServiceProviderBuilder<T>
-
Method Summary
Modifier and TypeMethodDescriptionadditionalFilter(InstanceFilter<T> filter) Add an instance filter.build()Allocate a new service provider based on the current builder settingsdownInstancePolicy(DownInstancePolicy downInstancePolicy) Set the down instance policyexecutorService(ExecutorService executorService) Optional ExecutorService to use for the cache's background thread.providerStrategy(ProviderStrategy<T> providerStrategy) optional - set the provider strategy.serviceName(String serviceName) required - set the name of the service to be providedthreadFactory(ThreadFactory threadFactory) Deprecated.
-
Method Details
-
build
ServiceProvider<T> build()Allocate a new service provider based on the current builder settings- Returns:
- provider
-
serviceName
required - set the name of the service to be provided- Parameters:
serviceName- the name of the service- Returns:
- this
-
providerStrategy
optional - set the provider strategy. The default isRoundRobinStrategy- Parameters:
providerStrategy- strategy to use- Returns:
- this
-
threadFactory
Deprecated.useexecutorService(ExecutorService)insteadoptional - the thread factory to use for creating internal threads. The specified ThreadFactory overrides any prior ThreadFactory or ClosableExecutorService set on the ServiceProviderBuilder- Parameters:
threadFactory- factory to use- Returns:
- this
-
downInstancePolicy
Set the down instance policy- Parameters:
downInstancePolicy- new policy- Returns:
- this
-
additionalFilter
Add an instance filter. NOTE: this does not remove previously added filters. i.e. a list is created of all added filters. Filters are called in the order they were added.- Parameters:
filter- filter to add- Returns:
- this
-
executorService
Optional ExecutorService to use for the cache's background thread. The specified ExecutorService will be wrapped in a CloseableExecutorService and overrides any prior ThreadFactory or CloseableExecutorService set on the ServiceProviderBuilder.- Parameters:
executorService- executor service- Returns:
- this
-
executorService(ExecutorService)instead