You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by jl...@apache.org on 2020/09/03 20:11:42 UTC

[incubator-pinot] 01/01: Set localhost as the base url in ControllerAdminApiApplication

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

jlli pushed a commit to branch switch-base-url
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit aa3424bab01c05ee08597e735b0c3d85398a1237
Author: Jack Li(Analytics Engineering) <jl...@jlli-mn1.linkedin.biz>
AuthorDate: Thu Sep 3 13:10:10 2020 -0700

    Set localhost as the base url in ControllerAdminApiApplication
---
 .../controller/api/ControllerAdminApiApplication.java     | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/ControllerAdminApiApplication.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/ControllerAdminApiApplication.java
index 2d1d335..ed77afe 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/ControllerAdminApiApplication.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/ControllerAdminApiApplication.java
@@ -152,15 +152,12 @@ public class ControllerAdminApiApplication extends ResourceConfig {
     beanConfig.setBasePath("/");
     beanConfig.setResourcePackage(RESOURCE_PACKAGE);
     beanConfig.setScan(true);
-    try {
-      Collection<NetworkListener> listeners = httpServer.getListeners();
-      if (listeners.size() > 0) {
-        // fetch the port from the first listener which uses http
-        int port = listeners.iterator().next().getPort();
-        beanConfig.setHost(InetAddress.getLocalHost().getHostName() + ":" + port);
-      }
-    } catch (UnknownHostException e) {
-      throw new RuntimeException("Cannot get localhost name");
+
+    Collection<NetworkListener> listeners = httpServer.getListeners();
+    if (listeners.size() > 0) {
+      // fetch the port from the first listener which uses http
+      int port = listeners.iterator().next().getPort();
+      beanConfig.setHost("localhost:" + port);
     }
 
     ClassLoader loader = this.getClass().getClassLoader();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org