public ServiceProviderImpl(ServiceDiscoveryEtcdImpl<T> discovery, String serviceName, ProviderStrategy<T> providerStrategy, ThreadFactory threadFactory, List<InstanceFilter<T>> filters, DownInstancePolicy downInstancePolicy) { this.discovery = discovery; this.providerStrategy = providerStrategy; downInstanceManager = new DownInstanceManager<T>(downInstancePolicy); cache = discovery.serviceCacheBuilder().name(serviceName).threadFactory(threadFactory).build(); List<InstanceFilter<T>> localFilters = Lists.newArrayList(filters); localFilters.add(downInstanceManager); instanceProvider = new FilteredInstanceProvider<T>(cache, localFilters); }
public ServiceProviderImpl(ServiceDiscoveryImpl<T> discovery, String serviceName, ProviderStrategy<T> providerStrategy, ThreadFactory threadFactory, List<InstanceFilter<T>> filters, DownInstancePolicy downInstancePolicy) { this.discovery = discovery; this.providerStrategy = providerStrategy; downInstanceManager = new DownInstanceManager<T>(downInstancePolicy); cache = discovery.serviceCacheBuilder().name(serviceName).threadFactory(threadFactory).build(); ArrayList<InstanceFilter<T>> localFilters = Lists.newArrayList(filters); localFilters.add(downInstanceManager); localFilters.add(new InstanceFilter<T>() { @Override public boolean apply(ServiceInstance<T> instance) { return instance.isEnabled(); } }); instanceProvider = new FilteredInstanceProvider<T>(cache, localFilters); }
public ServiceProviderImpl(ServiceDiscoveryImpl<T> discovery, String serviceName, ProviderStrategy<T> providerStrategy, ThreadFactory threadFactory, List<InstanceFilter<T>> filters, DownInstancePolicy downInstancePolicy) { this.discovery = discovery; this.providerStrategy = providerStrategy; downInstanceManager = new DownInstanceManager<T>(downInstancePolicy); cache = discovery.serviceCacheBuilder().name(serviceName).threadFactory(threadFactory).build(); ArrayList<InstanceFilter<T>> localFilters = Lists.newArrayList(filters); localFilters.add(downInstanceManager); localFilters.add(new InstanceFilter<T>() { @Override public boolean apply(ServiceInstance<T> instance) { return instance.isEnabled(); } }); instanceProvider = new FilteredInstanceProvider<T>(cache, localFilters); }