dianfu commented on a change in pull request #12165:
URL: https://github.com/apache/flink/pull/12165#discussion_r426139537
##########
File path:
flink-python/src/main/java/org/apache/flink/client/python/PythonDriver.java
##########
@@ -95,23 +104,36 @@ public static void main(String[] args) {
*
* @return The created GatewayServer
*/
- static GatewayServer startGatewayServer() {
- InetAddress localhost = InetAddress.getLoopbackAddress();
- GatewayServer gatewayServer = new
GatewayServer.GatewayServerBuilder()
- .javaPort(0)
- .javaAddress(localhost)
- .build();
- Thread thread = new Thread(gatewayServer::start);
+ static GatewayServer startGatewayServer() throws InterruptedException,
ExecutionException {
+ CompletableFuture<GatewayServer> gatewayServerFuture = new
CompletableFuture<>();
+ Thread thread = new Thread(() -> {
+ try {
+ int freePort = NetUtils.getAvailablePort();
+ GatewayServer server = new
GatewayServer.GatewayServerBuilder()
+ .gateway(new Gateway(new
ConcurrentHashMap<String, Object>(), new CallbackClient(freePort)))
Review comment:
I guess the CallbackClient is not needed in 1.9 and 1.10. What's your
thought? If so, the logic could be simplified a lot.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]