Class EndpointGroupRegistry
- java.lang.Object
-
- com.linecorp.armeria.client.endpoint.EndpointGroupRegistry
-
public final class EndpointGroupRegistry extends Object
An in-memory registry of server groups.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static EndpointGroup
get(String groupName)
Get theEndpointGroup
for the specified case-insensitivegroupName
.static EndpointSelector
getNodeSelector(String groupName)
Returns theEndpointSelector
for the specified case-insensitivegroupName
.static boolean
register(String groupName, EndpointGroup endpointGroup, EndpointSelectionStrategy endpointSelectionStrategy)
Registers the specifiedEndpointGroup
.static Endpoint
selectNode(ClientRequestContext ctx, String groupName)
Selects anEndpoint
from theEndpointGroup
associated with the specifiedClientRequestContext
and case-insensitivegroupName
.static boolean
unregister(String groupName)
Unregisters theEndpointGroup
with the specified case-insensitivegroupName
.
-
-
-
Method Detail
-
register
public static boolean register(String groupName, EndpointGroup endpointGroup, EndpointSelectionStrategy endpointSelectionStrategy)
Registers the specifiedEndpointGroup
. If there's already anEndpointGroup
with the specifiedgroupName
, this method will replace it with the new one.- Parameters:
groupName
- the case-insensitive name of theEndpointGroup
that matches the regular expression/^[-_.0-9a-zA-Z]+$/
endpointGroup
- theEndpointGroup
to registerendpointSelectionStrategy
- theEndpointSelectionStrategy
of the registered group- Returns:
true
if there was noEndpointGroup
with the specifiedgroupName
.false
if there was already anEndpointGroup
with the specifiedgroupName
and it has been replaced with the new one.
-
unregister
public static boolean unregister(String groupName)
Unregisters theEndpointGroup
with the specified case-insensitivegroupName
. Note that this is potentially a dangerous operation; make sure thegroupName
of the unregisteredEndpointGroup
is not in use by any clients.- Returns:
true
if theEndpointGroup
with the specifiedgroupName
has been removed.false
if there's no suchEndpointGroup
in the registry.
-
getNodeSelector
@Nullable public static EndpointSelector getNodeSelector(String groupName)
Returns theEndpointSelector
for the specified case-insensitivegroupName
.- Returns:
- the
EndpointSelector
, ornull
ifgroupName
has not been registered yet.
-
get
@Nullable public static EndpointGroup get(String groupName)
Get theEndpointGroup
for the specified case-insensitivegroupName
.- Returns:
- the
EndpointSelector
, ornull
ifgroupName
has not been registered yet.
-
selectNode
public static Endpoint selectNode(ClientRequestContext ctx, String groupName)
Selects anEndpoint
from theEndpointGroup
associated with the specifiedClientRequestContext
and case-insensitivegroupName
.
-
-