public final class EndpointGroupRegistry extends Object
| Modifier and Type | Method and Description |
|---|---|
static EndpointGroup |
get(String groupName)
Get the
EndpointGroup for the specified case-insensitive groupName. |
static EndpointSelector |
getNodeSelector(String groupName)
Returns the
EndpointSelector for the specified case-insensitive groupName. |
static boolean |
register(String groupName,
EndpointGroup endpointGroup,
EndpointSelectionStrategy endpointSelectionStrategy)
Registers the specified
EndpointGroup. |
static Endpoint |
selectNode(ClientRequestContext ctx,
String groupName)
Selects an
Endpoint from the EndpointGroup associated with the specified
ClientRequestContext and case-insensitive groupName. |
static boolean |
unregister(String groupName)
Unregisters the
EndpointGroup with the specified case-insensitive groupName. |
public static boolean register(String groupName, EndpointGroup endpointGroup, EndpointSelectionStrategy endpointSelectionStrategy)
EndpointGroup. If there's already an EndpointGroup with the
specified groupName, this method will replace it with the new one.groupName - the case-insensitive name of the EndpointGroup that matches
the regular expression /^[-_.0-9a-zA-Z]+$/endpointGroup - the EndpointGroup to registerendpointSelectionStrategy - the EndpointSelectionStrategy of the registered grouptrue if there was no EndpointGroup with the specified groupName.
false if there was already an EndpointGroup with the specified groupName
and it has been replaced with the new one.public static boolean unregister(String groupName)
EndpointGroup with the specified case-insensitive groupName.
Note that this is potentially a dangerous operation; make sure the groupName of the unregistered
EndpointGroup is not in use by any clients.true if the EndpointGroup with the specified groupName has been removed.
false if there's no such EndpointGroup in the registry.@Nullable public static EndpointSelector getNodeSelector(String groupName)
EndpointSelector for the specified case-insensitive groupName.EndpointSelector, or null if groupName has not been registered yet.@Nullable public static EndpointGroup get(String groupName)
EndpointGroup for the specified case-insensitive groupName.EndpointSelector, or null if groupName has not been registered yet.public static Endpoint selectNode(ClientRequestContext ctx, String groupName)
Endpoint from the EndpointGroup associated with the specified
ClientRequestContext and case-insensitive groupName.Copyright © 2020 LeanCloud. All rights reserved.