Interface EndpointGroup
- All Superinterfaces:
AsyncCloseable,AutoCloseable,EndpointSelector,Listenable<List<Endpoint>>
- All Known Implementing Classes:
ConsulEndpointGroup,DnsAddressEndpointGroup,DnsServiceEndpointGroup,DnsTextEndpointGroup,DynamicEndpointGroup,Endpoint,EurekaEndpointGroup,HealthCheckedEndpointGroup,PropertiesEndpointGroup,ZooKeeperEndpointGroup
A list of
Endpoints.-
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddListener(Consumer<? super List<Endpoint>> listener)Adds aConsumerthat will be invoked when aListenablechanges its value.Returns the endpoints held by thisEndpointGroup.static EndpointGroupof()Returns a singletonEndpointGroupwhich does not contain anyEndpoints.static EndpointGroupof(EndpointGroup... endpointGroups)static EndpointGroupof(EndpointSelectionStrategy selectionStrategy, EndpointGroup... endpointGroups)static EndpointGroupof(EndpointSelectionStrategy selectionStrategy, Iterable<? extends EndpointGroup> endpointGroups)static EndpointGroupof(Iterable<? extends EndpointGroup> endpointGroups)default EndpointGrouporElse(EndpointGroup nextEndpointGroup)Creates a newEndpointGroupthat tries thisEndpointGroupfirst and then the specifiedEndpointGroupwhen thisEndpointGroupdoes not have a requested resource.default voidremoveListener(Consumer<?> listener)Remove a listener.Returns theEndpointSelectionStrategyof thisEndpointGroup.Selects anEndpointfrom thisEndpointGroup.Returns aCompletableFuturewhich is completed when the initialEndpoints are ready.Methods inherited from interface com.linecorp.armeria.common.util.AsyncCloseable
close, closeAsyncMethods inherited from interface com.linecorp.armeria.client.endpoint.EndpointSelector
select
-
Method Details
-
of
Returns a singletonEndpointGroupwhich does not contain anyEndpoints. -
of
Returns anEndpointGroupthat combines all theEndpoints ofendpointGroups.endpointGroupscan be instances ofEndpointas well, anyEndpointGroups andEndpointwill all be combined into a singleEndpointGroupthat contains the total set. TheEndpointGroupreturned by this method will useEndpointSelectionStrategy.weightedRoundRobin()for selecting anEndpoint. -
of
static EndpointGroup of(EndpointSelectionStrategy selectionStrategy, EndpointGroup... endpointGroups)Returns anEndpointGroupthat combines all theEndpoints ofendpointGroups.endpointGroupscan be instances ofEndpointas well, anyEndpointGroups andEndpointwill all be combined into a singleEndpointGroupthat contains the total set. -
of
Returns anEndpointGroupthat combines all theEndpoints ofendpointGroups.endpointGroupscan be instances ofEndpointas well, anyEndpointGroups andEndpointwill all be combined into a singleEndpointGroupthat contains the total set. TheEndpointGroupreturned by this method will useEndpointSelectionStrategy.weightedRoundRobin()for selecting anEndpoint. -
of
static EndpointGroup of(EndpointSelectionStrategy selectionStrategy, Iterable<? extends EndpointGroup> endpointGroups)Returns anEndpointGroupthat combines all theEndpoints ofendpointGroups.endpointGroupscan be instances ofEndpointas well, anyEndpointGroups andEndpointwill all be combined into a singleEndpointGroupthat contains the total set. -
endpoints
Returns the endpoints held by thisEndpointGroup. -
selectionStrategy
EndpointSelectionStrategy selectionStrategy()Returns theEndpointSelectionStrategyof thisEndpointGroup. -
selectNow
Selects anEndpointfrom thisEndpointGroup.- Specified by:
selectNowin interfaceEndpointSelector- Returns:
- the
Endpointselected by theEndpointSelectionStrategy, which was specified when constructing thisEndpointGroup, ornullif thisEndpointGroupis empty.
-
whenReady
CompletableFuture<List<Endpoint>> whenReady()Returns aCompletableFuturewhich is completed when the initialEndpoints are ready. -
addListener
Description copied from interface:ListenableAdds aConsumerthat will be invoked when aListenablechanges its value.- Specified by:
addListenerin interfaceListenable<List<Endpoint>>
-
removeListener
Description copied from interface:ListenableRemove a listener.- Specified by:
removeListenerin interfaceListenable<List<Endpoint>>
-
orElse
Creates a newEndpointGroupthat tries thisEndpointGroupfirst and then the specifiedEndpointGroupwhen thisEndpointGroupdoes not have a requested resource.- Parameters:
nextEndpointGroup- theEndpointGroupto try secondly.
-