/** * Create a deployment URI selector that prefers one or more favorite nodes, falling back to another selector if * none of the favorites are found. * * @param favorites the favorite nodes, in decreasing order of preference (must not be {@code null}) * @param fallback the fallback selector (must not be {@code null}) * @return the selector (not {@code null}) */ static DiscoveredURISelector favorite(Collection<URI> favorites, DiscoveredURISelector fallback) { Assert.checkNotNullParam("favorites", favorites); Assert.checkNotNullParam("fallback", fallback); return (eligibleUris, locator) -> { for (URI favorite : favorites) { if (eligibleUris.contains(favorite)) { return favorite; } } return fallback.selectNode(eligibleUris, locator); }; }
location = selector.selectNode(new ArrayList<>(nodes.keySet()), locator); if (location == null) { throw Logs.INVOCATION.selectorReturnedNull(selector);
/** * Create a deployment URI selector that prefers one or more favorite nodes, falling back to another selector if * none of the favorites are found. * * @param favorites the favorite nodes, in decreasing order of preference (must not be {@code null}) * @param fallback the fallback selector (must not be {@code null}) * @return the selector (not {@code null}) */ static DiscoveredURISelector favorite(Collection<URI> favorites, DiscoveredURISelector fallback) { Assert.checkNotNullParam("favorites", favorites); Assert.checkNotNullParam("fallback", fallback); return (eligibleUris, locator) -> { for (URI favorite : favorites) { if (eligibleUris.contains(favorite)) { return favorite; } } return fallback.selectNode(eligibleUris, locator); }; }
/** * Create a deployment URI selector that prefers one or more favorite nodes, falling back to another selector if * none of the favorites are found. * * @param favorites the favorite nodes, in decreasing order of preference (must not be {@code null}) * @param fallback the fallback selector (must not be {@code null}) * @return the selector (not {@code null}) */ static DiscoveredURISelector favorite(Collection<URI> favorites, DiscoveredURISelector fallback) { Assert.checkNotNullParam("favorites", favorites); Assert.checkNotNullParam("fallback", fallback); return (eligibleUris, locator) -> { for (URI favorite : favorites) { if (eligibleUris.contains(favorite)) { return favorite; } } return fallback.selectNode(eligibleUris, locator); }; }
location = selector.selectNode(new ArrayList<>(nodes.keySet()), locator); if (location == null) { throw Logs.INVOCATION.selectorReturnedNull(selector);
location = selector.selectNode(new ArrayList<>(nodes.keySet()), locator); if (location == null) { throw Logs.INVOCATION.selectorReturnedNull(selector);