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

davidyan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apex-malhar.git


The following commit(s) were added to refs/heads/master by this push:
     new 934c201  APEXMALHAR-2550 use the launch machine host name for default 
pub/sub address.
934c201 is described below

commit 934c201d47e824ec5017506908b578749454153c
Author: Thomas Weise <t...@apache.org>
AuthorDate: Wed Nov 29 07:35:10 2017 -0800

    APEXMALHAR-2550 use the launch machine host name for default pub/sub 
address.
---
 .../java/org/apache/apex/examples/nyctaxi/Application.java     | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/examples/nyctaxi/src/main/java/org/apache/apex/examples/nyctaxi/Application.java
 
b/examples/nyctaxi/src/main/java/org/apache/apex/examples/nyctaxi/Application.java
index a484ec7..a59c3a4 100644
--- 
a/examples/nyctaxi/src/main/java/org/apache/apex/examples/nyctaxi/Application.java
+++ 
b/examples/nyctaxi/src/main/java/org/apache/apex/examples/nyctaxi/Application.java
@@ -21,6 +21,7 @@ package org.apache.apex.examples.nyctaxi;
 
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.net.UnknownHostException;
 
 import org.joda.time.Duration;
 
@@ -33,6 +34,7 @@ import 
org.apache.apex.malhar.lib.window.impl.InMemoryWindowedStorage;
 import org.apache.apex.malhar.lib.window.impl.KeyedWindowedOperatorImpl;
 import org.apache.commons.lang3.mutable.MutableDouble;
 import org.apache.hadoop.conf.Configuration;
+
 import com.google.common.base.Throwables;
 
 import com.datatorrent.api.DAG;
@@ -87,16 +89,16 @@ public class Application implements StreamingApplication
     wsQuery.enableEmbeddedMode();
     wsQuery.setTopic("nyctaxi.query");
     try {
-      wsQuery.setUri(new URI("ws://localhost:8890/pubsub"));
-    } catch (URISyntaxException ex) {
+      wsQuery.setUri(new URI("ws://" + 
java.net.InetAddress.getLocalHost().getHostName() + ":8890/pubsub"));
+    } catch (URISyntaxException | UnknownHostException ex) {
       throw Throwables.propagate(ex);
     }
     dataServer.setEmbeddableQueryInfoProvider(wsQuery);
     PubSubWebSocketAppDataResult wsResult = dag.addOperator("QueryResult", new 
PubSubWebSocketAppDataResult());
     wsResult.setTopic("nyctaxi.result");
     try {
-      wsResult.setUri(new URI("ws://localhost:8890/pubsub"));
-    } catch (URISyntaxException ex) {
+      wsResult.setUri(new URI("ws://" + 
java.net.InetAddress.getLocalHost().getHostName() + ":8890/pubsub"));
+    } catch (URISyntaxException | UnknownHostException ex) {
       throw Throwables.propagate(ex);
     }
     dag.addStream("server_to_query_output", dataServer.queryResult, 
wsResult.input);

-- 
To stop receiving notification emails like this one, please contact
['"commits@apex.apache.org" <commits@apex.apache.org>'].

Reply via email to