Github user kl0u commented on a diff in the pull request:
https://github.com/apache/flink/pull/5473#discussion_r169131469
--- Diff:
flink-metrics/flink-metrics-prometheus/src/test/java/org/apache/flink/metrics/prometheus/PrometheusReporterTest.java
---
@@ -287,4 +283,32 @@ static Configuration
createConfigWithOneReporter(String reporterName, String por
public void closeReporterAndShutdownRegistry() {
registry.shutdown();
}
+
+ /**
+ * Utility class providing distinct port ranges.
+ */
+ private static class PortRangeProvider implements Iterator<String> {
+
+ private int base = 9000;
+
+ @Override
+ public boolean hasNext() {
+ return base < 14000; // arbitrary limit that should be
sufficient for test purposes
+ }
+
+ /**
+ * Returns the next port range containing exactly 100 ports.
+ *
+ * @return next port range
+ */
+ public synchronized String next() {
+ if (!hasNext()) {
--- End diff --
I think the `synchronized` here is not needed as there does not seem to be
any concurrent access.
---