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/07/18 07:51:28 UTC
[2/3] flink git commit: [hotfix][rest] Simplify dispatcher host
retrieval
[hotfix][rest] Simplify dispatcher host retrieval
Adjusted to work like the JobSubmitHandler.
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/9d24432d
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/9d24432d
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/9d24432d
Branch: refs/heads/master
Commit: 9d24432d086aa816ef35ef9c1f11f6ac6cd0a5cd
Parents: 5a89b9a
Author: zentol <ch...@apache.org>
Authored: Wed Jul 11 18:37:15 2018 +0200
Committer: Till Rohrmann <tr...@apache.org>
Committed: Wed Jul 18 09:50:09 2018 +0200
----------------------------------------------------------------------
.../runtime/webmonitor/handlers/JarRunHandler.java | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/9d24432d/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JarRunHandler.java
----------------------------------------------------------------------
diff --git a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JarRunHandler.java b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JarRunHandler.java
index 1e620d4..858a05c 100644
--- a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JarRunHandler.java
+++ b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JarRunHandler.java
@@ -35,14 +35,11 @@ import org.apache.flink.runtime.rest.handler.HandlerRequest;
import org.apache.flink.runtime.rest.handler.RestHandlerException;
import org.apache.flink.runtime.rest.messages.EmptyRequestBody;
import org.apache.flink.runtime.rest.messages.MessageHeaders;
-import org.apache.flink.runtime.util.ScalaUtils;
import org.apache.flink.runtime.webmonitor.retriever.GatewayRetriever;
import org.apache.flink.util.FlinkException;
import org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus;
-import akka.actor.AddressFromURIString;
-
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -51,7 +48,6 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.Executor;
@@ -112,7 +108,7 @@ public class JarRunHandler extends
CompletableFuture<Integer> blobServerPortFuture = gateway.getBlobServerPort(timeout);
CompletableFuture<JobGraph> jarUploadFuture = jobGraphFuture.thenCombine(blobServerPortFuture, (jobGraph, blobServerPort) -> {
- final InetSocketAddress address = new InetSocketAddress(getDispatcherHost(gateway), blobServerPort);
+ final InetSocketAddress address = new InetSocketAddress(gateway.getHostname(), blobServerPort);
try {
ClientUtils.extractAndUploadJobGraphFiles(jobGraph, () -> new BlobClient(address, configuration));
} catch (FlinkException e) {
@@ -182,15 +178,4 @@ public class JarRunHandler extends
return jobGraph;
}, executor);
}
-
- private static String getDispatcherHost(DispatcherGateway gateway) {
- String dispatcherAddress = gateway.getAddress();
- final Optional<String> host = ScalaUtils.toJava(AddressFromURIString.parse(dispatcherAddress).host());
-
- return host.orElseGet(() -> {
- // if the dispatcher address does not contain a host part, then assume it's running
- // on the same machine as the handler
- return "localhost";
- });
- }
}