You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2018/07/19 08:27:11 UTC
[4/6] 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/67cd33ea
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/67cd33ea
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/67cd33ea
Branch: refs/heads/release-1.5
Commit: 67cd33ea38d0f4ae85b9592dd76a668a190c7650
Parents: 78acb7b
Author: zentol <ch...@apache.org>
Authored: Wed Jul 11 18:37:15 2018 +0200
Committer: zentol <ch...@apache.org>
Committed: Thu Jul 19 10:27:02 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/67cd33ea/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 2e928b0..b3e1ff8 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;
@@ -52,7 +49,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;
@@ -113,7 +109,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);
final List<PermanentBlobKey> keys;
try {
keys = BlobClient.uploadJarFiles(address, configuration, jobGraph.getJobID(), jobGraph.getUserJars());
@@ -188,15 +184,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";
- });
- }
}