AHeise commented on a change in pull request #16108:
URL: https://github.com/apache/flink/pull/16108#discussion_r769392660



##########
File path: 
flink-clients/src/test/java/org/apache/flink/client/program/ClientTest.java
##########
@@ -102,10 +102,11 @@ public void setUp() throws Exception {
         env.generateSequence(1, 1000).output(new DiscardingOutputFormat<>());
         plan = env.createProgramPlan();
 
-        final int freePort = NetUtils.getAvailablePort();
         config = new Configuration();
         config.setString(JobManagerOptions.ADDRESS, "localhost");
-        config.setInteger(JobManagerOptions.PORT, freePort);
+        try (NetUtils.Port port = NetUtils.getAvailablePort()) {

Review comment:
       This should be `port = NetUtils.getAvailablePort()` where port is a 
field in the test class. In a `@After` you'd then call `port.close()`.




-- 
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]


Reply via email to