You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2018/09/28 14:35:06 UTC

[flink] 07/08: [hotfix] Remove DispatcherProcess#getJobManagerPort function

This is an automated email from the ASF dual-hosted git repository.

trohrmann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit b0d5e99319f6dc38da890e389f8b1a7e2cabe6cf
Author: Till Rohrmann <tr...@apache.org>
AuthorDate: Mon Sep 24 10:31:46 2018 +0200

    [hotfix] Remove DispatcherProcess#getJobManagerPort function
---
 .../flink/runtime/testutils/DispatcherProcess.java | 45 +---------------------
 1 file changed, 1 insertion(+), 44 deletions(-)

diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/testutils/DispatcherProcess.java b/flink-runtime/src/test/java/org/apache/flink/runtime/testutils/DispatcherProcess.java
index 79b0dc3..85d3caa 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/testutils/DispatcherProcess.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/testutils/DispatcherProcess.java
@@ -32,11 +32,6 @@ import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
 import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import scala.concurrent.duration.Deadline;
-import scala.concurrent.duration.FiniteDuration;
 
 import static org.apache.flink.util.Preconditions.checkArgument;
 import static org.apache.flink.util.Preconditions.checkNotNull;
@@ -48,9 +43,6 @@ public class DispatcherProcess extends TestJvmProcess {
 
 	private static final Logger LOG = LoggerFactory.getLogger(JobManagerProcess.class);
 
-	/** Pattern to parse the job manager port from the logs. */
-	private static final Pattern PORT_PATTERN = Pattern.compile(".*Actor system started at akka\\.tcp://flink@.*:(\\d+).*");
-
 	/** ID for this JobManager. */
 	private final int id;
 
@@ -60,9 +52,6 @@ public class DispatcherProcess extends TestJvmProcess {
 	/** Configuration parsed as args for {@link JobManagerProcess.JobManagerProcessEntryPoint}. */
 	private final String[] jvmArgs;
 
-	/** The port the JobManager listens on. */
-	private int jobManagerPort;
-
 	/**
 	 * Creates a {@link JobManager} running in a separate JVM.
 	 *
@@ -106,41 +95,9 @@ public class DispatcherProcess extends TestJvmProcess {
 		return config;
 	}
 
-	/**
-	 * Parses the port from the job manager logs and returns it.
-	 *
-	 * <p>If a call to this method succeeds, successive calls will directly
-	 * return the port and re-parse the logs.
-	 *
-	 * @param timeout Timeout for log parsing.
-	 * @return The port of the job manager
-	 * @throws InterruptedException  If interrupted while waiting before
-	 *                               retrying to parse the logs
-	 * @throws NumberFormatException If the parsed port is not a number
-	 */
-	public int getJobManagerPort(FiniteDuration timeout) throws InterruptedException, NumberFormatException {
-		if (jobManagerPort > 0) {
-			return jobManagerPort;
-		} else {
-			Deadline deadline = timeout.fromNow();
-			while (deadline.hasTimeLeft()) {
-				Matcher matcher = PORT_PATTERN.matcher(getProcessOutput());
-				if (matcher.find()) {
-					String port = matcher.group(1);
-					jobManagerPort = Integer.parseInt(port);
-					return jobManagerPort;
-				} else {
-					Thread.sleep(100);
-				}
-			}
-
-			throw new RuntimeException("Could not parse port from logs");
-		}
-	}
-
 	@Override
 	public String toString() {
-		return String.format("JobManagerProcess(id=%d, port=%d)", id, jobManagerPort);
+		return String.format("JobManagerProcess(id=%d)", id);
 	}
 
 	/**