You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/05/16 10:07:46 UTC

[GitHub] [flink] dianfu commented on a change in pull request #12165: [FLINK-17700][python] The callback client of JavaGatewayServer should…

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?




----------------------------------------------------------------
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:
users@infra.apache.org