public class ServiceProviderImpl<T> extends Object implements ServiceProvider<T>
Modifier | Constructor and Description |
---|---|
protected |
ServiceProviderImpl(ServiceDiscoveryImpl<T> discovery,
String serviceName,
ProviderStrategy<T> providerStrategy,
ThreadFactory threadFactory,
ExecutorService executorService,
List<InstanceFilter<T>> filters,
DownInstancePolicy downInstancePolicy) |
|
ServiceProviderImpl(ServiceDiscoveryImpl<T> discovery,
String serviceName,
ProviderStrategy<T> providerStrategy,
ThreadFactory threadFactory,
List<InstanceFilter<T>> filters,
DownInstancePolicy downInstancePolicy) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the provider.
|
Collection<ServiceInstance<T>> |
getAllInstances()
Return the current available set of instances IMPORTANT: users
should not hold on to the instance returned.
|
ServiceInstance<T> |
getInstance()
Return an instance for a single use.
|
void |
noteError(ServiceInstance<T> instance)
Take note of an error connecting to the given instance.
|
void |
start()
The provider must be started before use
|
public ServiceProviderImpl(ServiceDiscoveryImpl<T> discovery, String serviceName, ProviderStrategy<T> providerStrategy, ThreadFactory threadFactory, List<InstanceFilter<T>> filters, DownInstancePolicy downInstancePolicy)
protected ServiceProviderImpl(ServiceDiscoveryImpl<T> discovery, String serviceName, ProviderStrategy<T> providerStrategy, ThreadFactory threadFactory, ExecutorService executorService, List<InstanceFilter<T>> filters, DownInstancePolicy downInstancePolicy)
public void start() throws Exception
start
in interface ServiceProvider<T>
Exception
- any errorspublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface ServiceProvider<T>
IOException
public Collection<ServiceInstance<T>> getAllInstances() throws Exception
getAllInstances
in interface ServiceProvider<T>
Exception
- any errorspublic ServiceInstance<T> getInstance() throws Exception
getInstance
in interface ServiceProvider<T>
Exception
- any errorspublic void noteError(ServiceInstance<T> instance)
ServiceProvider
DownInstancePolicy
.noteError
in interface ServiceProvider<T>
instance
- instance that had an errorCopyright © 2011–2023 The Apache Software Foundation. All rights reserved.