Copilot commented on code in PR #7483:
URL: https://github.com/apache/ignite-3/pull/7483#discussion_r2731670073
##########
modules/network/src/main/java/org/apache/ignite/internal/network/StaticNodeFinder.java:
##########
@@ -44,19 +44,49 @@
*/
public class StaticNodeFinder implements NodeFinder {
private static final IgniteLogger LOG =
Loggers.forClass(StaticNodeFinder.class);
+
private static final long RETRY_WAIT_BASE_MILLIS = 500;
- private static final int MAX_TRIES = 3;
/** List of seed cluster members. */
- private final List<NetworkAddress> addresses;
+ private final Set<NetworkAddress> addresses;
+
+ private final int nameResolutionAttempts;
+
+ private final HostNameResolver hostNameResolver;
+
+ /**
+ * Class for resolving host names.
+ *
+ * <p>Needed for writing cleaner tests.
+ */
+ @FunctionalInterface
+ public interface HostNameResolver {
+ /**
+ * Given the name of a host, returns an array of its IP addresses,
based on the configured name service on the system.
+ */
+ InetAddress[] getAllByName(String host) throws UnknownHostException;
+ }
/**
* Constructor.
*
* @param addresses Addresses of initial cluster members.
*/
+ @TestOnly
public StaticNodeFinder(List<NetworkAddress> addresses) {
- this.addresses = addresses;
+ this(addresses, InetAddress::getAllByName, 1);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param addresses Addresses of initial cluster members.
Review Comment:
The Javadoc for this constructor is now out of sync with the method
signature: there is no `@param` documentation for `hostNameResolver`, and the
existing `@param nameResolutionAttempts` tag does not match the parameter
order. Please update the Javadoc to document `hostNameResolver` and reorder the
`@param` tags to correspond to the actual parameter list.
```suggestion
* @param addresses Addresses of initial cluster members.
* @param hostNameResolver Resolver used to resolve host names from the
{@code addresses} list.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]