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
Endpoint
s.-
Method Summary
Modifier and TypeMethodDescriptiondefault void
addListener
(Consumer<? super List<Endpoint>> listener) Adds aConsumer
that will be invoked when aListenable
changes its value.default void
addListener
(Consumer<? super List<Endpoint>> listener, boolean notifyLatestEndpoints) Adds aConsumer
that will be invoked when thisEndpointGroup
changes its value.Returns the endpoints held by thisEndpointGroup
.static EndpointGroup
of()
Returns a singletonEndpointGroup
which does not contain anyEndpoint
s.static EndpointGroup
of
(EndpointGroup... endpointGroups) static EndpointGroup
of
(EndpointSelectionStrategy selectionStrategy, EndpointGroup... endpointGroups) static EndpointGroup
of
(EndpointSelectionStrategy selectionStrategy, Iterable<? extends EndpointGroup> endpointGroups) static EndpointGroup
of
(Iterable<? extends EndpointGroup> endpointGroups) default EndpointGroup
orElse
(EndpointGroup nextEndpointGroup) Creates a newEndpointGroup
that tries thisEndpointGroup
first and then the specifiedEndpointGroup
when thisEndpointGroup
does not have a requested resource.default void
removeListener
(Consumer<?> listener) Remove a listener.Returns theEndpointSelectionStrategy
of thisEndpointGroup
.Selects anEndpoint
from thisEndpointGroup
.Returns aCompletableFuture
which is completed when the initialEndpoint
s are ready.Methods inherited from interface com.linecorp.armeria.common.util.AsyncCloseable
close, closeAsync
Methods inherited from interface com.linecorp.armeria.client.endpoint.EndpointSelector
select
-
Method Details
-
of
Returns a singletonEndpointGroup
which does not contain anyEndpoint
s. -
of
Returns anEndpointGroup
that combines all theEndpoint
s ofendpointGroups
.endpointGroups
can be instances ofEndpoint
as well, anyEndpointGroup
s andEndpoint
will all be combined into a singleEndpointGroup
that contains the total set. TheEndpointGroup
returned by this method will useEndpointSelectionStrategy.weightedRoundRobin()
for selecting anEndpoint
. -
of
static EndpointGroup of(EndpointSelectionStrategy selectionStrategy, EndpointGroup... endpointGroups) Returns anEndpointGroup
that combines all theEndpoint
s ofendpointGroups
.endpointGroups
can be instances ofEndpoint
as well, anyEndpointGroup
s andEndpoint
will all be combined into a singleEndpointGroup
that contains the total set. -
of
Returns anEndpointGroup
that combines all theEndpoint
s ofendpointGroups
.endpointGroups
can be instances ofEndpoint
as well, anyEndpointGroup
s andEndpoint
will all be combined into a singleEndpointGroup
that contains the total set. TheEndpointGroup
returned by this method will useEndpointSelectionStrategy.weightedRoundRobin()
for selecting anEndpoint
. -
of
static EndpointGroup of(EndpointSelectionStrategy selectionStrategy, Iterable<? extends EndpointGroup> endpointGroups) Returns anEndpointGroup
that combines all theEndpoint
s ofendpointGroups
.endpointGroups
can be instances ofEndpoint
as well, anyEndpointGroup
s andEndpoint
will all be combined into a singleEndpointGroup
that contains the total set. -
endpoints
Returns the endpoints held by thisEndpointGroup
. -
selectionStrategy
EndpointSelectionStrategy selectionStrategy()Returns theEndpointSelectionStrategy
of thisEndpointGroup
. -
selectNow
Selects anEndpoint
from thisEndpointGroup
.- Specified by:
selectNow
in interfaceEndpointSelector
- Returns:
- the
Endpoint
selected by theEndpointSelectionStrategy
, which was specified when constructing thisEndpointGroup
, ornull
if thisEndpointGroup
is empty.
-
whenReady
CompletableFuture<List<Endpoint>> whenReady()Returns aCompletableFuture
which is completed when the initialEndpoint
s are ready. -
addListener
Description copied from interface:Listenable
Adds aConsumer
that will be invoked when aListenable
changes its value.- Specified by:
addListener
in interfaceListenable<List<Endpoint>>
-
addListener
Adds aConsumer
that will be invoked when thisEndpointGroup
changes its value. IfnotifyLatestEndpoints
is set to true and thewhenReady()
is completed already, theConsumer
will be invoked immediately with the currentendpoints()
. -
removeListener
Description copied from interface:Listenable
Remove a listener.- Specified by:
removeListener
in interfaceListenable<List<Endpoint>>
-
orElse
Creates a newEndpointGroup
that tries thisEndpointGroup
first and then the specifiedEndpointGroup
when thisEndpointGroup
does not have a requested resource.- Parameters:
nextEndpointGroup
- theEndpointGroup
to try secondly.
-