[ https://issues.apache.org/jira/browse/FLINK-8621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16369321#comment-16369321 ]
ASF GitHub Bot commented on FLINK-8621: --------------------------------------- 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. > PrometheusReporterTest.endpointIsUnavailableAfterReporterIsClosed unstable on > Travis > ------------------------------------------------------------------------------------ > > Key: FLINK-8621 > URL: https://issues.apache.org/jira/browse/FLINK-8621 > Project: Flink > Issue Type: Bug > Components: Metrics, Tests > Affects Versions: 1.5.0 > Reporter: Till Rohrmann > Assignee: Chesnay Schepler > Priority: Blocker > Labels: test-stability > Fix For: 1.5.0, 1.4.2 > > > {{PrometheusReporterTest.endpointIsUnavailableAfterReporterIsClosed}} fails > on Travis: https://travis-ci.org/apache/flink/jobs/339344244 -- This message was sent by Atlassian JIRA (v7.6.3#76005)