Package io.servicetalk.client.api
Class DelegatingServiceDiscoverer<UnresolvedAddress,ResolvedAddress,E extends ServiceDiscovererEvent<ResolvedAddress>>
java.lang.Object
io.servicetalk.concurrent.api.DelegatingAsyncCloseable<T>
io.servicetalk.concurrent.api.DelegatingListenableAsyncCloseable<ServiceDiscoverer<UnresolvedAddress,ResolvedAddress,E>>
io.servicetalk.client.api.DelegatingServiceDiscoverer<UnresolvedAddress,ResolvedAddress,E>
- Type Parameters:
UnresolvedAddress- The type of address before resolution.ResolvedAddress- The type of address after resolution.E- Type ofServiceDiscovererEvents published fromdiscover(Object).
- All Implemented Interfaces:
ServiceDiscoverer<UnresolvedAddress,,ResolvedAddress, E> AsyncCloseable,ListenableAsyncCloseable
public class DelegatingServiceDiscoverer<UnresolvedAddress,ResolvedAddress,E extends ServiceDiscovererEvent<ResolvedAddress>>
extends DelegatingListenableAsyncCloseable<ServiceDiscoverer<UnresolvedAddress,ResolvedAddress,E>>
implements ServiceDiscoverer<UnresolvedAddress,ResolvedAddress,E>
A
ServiceDiscoverer that delegates all methods to another ServiceDiscoverer.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected final ServiceDiscoverer<UnresolvedAddress,ResolvedAddress, E> delegate()Get theServiceDiscovererthat this class delegates to.discover(UnresolvedAddress address) Subscribe to the service discovery system for changes in the availableServiceDiscovererassociated withaddress.Methods inherited from class io.servicetalk.concurrent.api.DelegatingListenableAsyncCloseable
onClose, onClosingMethods inherited from class io.servicetalk.concurrent.api.DelegatingAsyncCloseable
closeAsync, closeAsyncGracefully, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefullyMethods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose, onClosing
-
Constructor Details
-
DelegatingServiceDiscoverer
Creates a new instance.- Parameters:
delegate-ServiceDiscovererto which all methods are delegated.
-
-
Method Details
-
delegate
Get theServiceDiscovererthat this class delegates to.- Overrides:
delegatein classDelegatingListenableAsyncCloseable<ServiceDiscoverer<UnresolvedAddress,ResolvedAddress, E extends ServiceDiscovererEvent<ResolvedAddress>>> - Returns:
- the
ServiceDiscovererthat this class delegates to.
-
discover
Description copied from interface:ServiceDiscovererSubscribe to the service discovery system for changes in the availableServiceDiscovererassociated withaddress.In general a call to this method will continue to discover changes related to
addressuntil theSubscriptioncorresponding to the return value iscancelledorPublisherfails with an error. The returnedPublishershould nevercompletebecause underlying system may run for a long period of time and updates may be required at any time in the future. The returnedPublisherMUST support re-subscribes to allow underlying systems retry failures or re-subscribe aftercancellation.- Specified by:
discoverin interfaceServiceDiscoverer<UnresolvedAddress,ResolvedAddress, E extends ServiceDiscovererEvent<ResolvedAddress>> - Parameters:
address- the service address to discover. Examples of what this address maybe are:- hostname/port (e.g. InetAddress)
- service name
- it may be a list of attributes which describe the service attributes to resolve
- something else
- Returns:
- a
Publisherthat represents a stream of events from the service discovery system.
-