public class ServiceProviderImpl<T> extends Object implements ServiceProvider<T>
| Constructor and Description |
|---|
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() |
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)
public void start()
throws Exception
start in interface ServiceProvider<T>Exception - any errorspublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic 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)
ServiceProviderDownInstancePolicy.noteError in interface ServiceProvider<T>instance - instance that had an errorCopyright © 2011–2016 The Apache Software Foundation. All rights reserved.