java.io.Closeable, java.lang.AutoCloseable, ServiceProvider<T>public class ServiceProviderImpl<T> extends java.lang.Object implements ServiceProvider<T>
| Constructor | Description |
|---|---|
ServiceProviderImpl(ServiceDiscoveryImpl<T> discovery,
java.lang.String serviceName,
ProviderStrategy<T> providerStrategy,
java.util.concurrent.ThreadFactory threadFactory,
java.util.List<InstanceFilter<T>> filters,
DownInstancePolicy downInstancePolicy) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Close the provider.
|
java.util.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, java.lang.String serviceName, ProviderStrategy<T> providerStrategy, java.util.concurrent.ThreadFactory threadFactory, java.util.List<InstanceFilter<T>> filters, DownInstancePolicy downInstancePolicy)
public void start()
throws java.lang.Exception
start in interface ServiceProvider<T>java.lang.Exception - any errorspublic void close()
throws java.io.IOException
close in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in interface ServiceProvider<T>java.io.IOExceptionpublic java.util.Collection<ServiceInstance<T>> getAllInstances() throws java.lang.Exception
getAllInstances in interface ServiceProvider<T>java.lang.Exception - any errorspublic ServiceInstance<T> getInstance() throws java.lang.Exception
getInstance in interface ServiceProvider<T>java.lang.Exception - any errorspublic void noteError(ServiceInstance<T> instance)
ServiceProviderDownInstancePolicy.noteError in interface ServiceProvider<T>instance - instance that had an errorCopyright © 2011–2018 The Apache Software Foundation. All rights reserved.