use of org.apache.ignite.configuration.schemas.network.NodeFinderType in project ignite-3 by apache.
the class NodeFinderFactory method createNodeFinder.
/**
* Creates a {@link NodeFinder} based on the provided configuration.
*
* @param nodeFinderConfiguration Node finder configuration.
* @return Node finder.
*/
public static NodeFinder createNodeFinder(NodeFinderView nodeFinderConfiguration) {
String typeString = nodeFinderConfiguration.type();
NodeFinderType type;
try {
type = NodeFinderType.valueOf(typeString);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Failed to create NodeFinder " + typeString, e);
}
switch(type) {
case STATIC:
return Arrays.stream(nodeFinderConfiguration.netClusterNodes()).map(NetworkAddress::from).collect(collectingAndThen(toUnmodifiableList(), StaticNodeFinder::new));
default:
throw new IllegalArgumentException("Unsupported NodeFinder type " + type);
}
}
Aggregations