apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From PramodSSImmaneni <...@git.apache.org>
Subject [GitHub] incubator-apex-core pull request: APEX-181 expose getting of rm we...
Date Wed, 07 Oct 2015 16:16:04 GMT
Github user PramodSSImmaneni commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/103#discussion_r41410996
  
    --- Diff: engine/src/main/java/com/datatorrent/stram/client/StramClientUtils.java ---
    @@ -732,4 +734,45 @@ public static ApplicationReport getStartedAppInstanceByName(YarnClient
clientRMS
         return null;
       }
     
    +  public static InetSocketAddress getRMWebAddress(Configuration conf, String rmId)
    +  {
    +    boolean sslEnabled = conf.getBoolean(CommonConfigurationKeysPublic.HADOOP_SSL_ENABLED_KEY,
CommonConfigurationKeysPublic.HADOOP_SSL_ENABLED_DEFAULT);
    +    return getRMWebAddress(conf, sslEnabled, rmId);
    +  }
    +
    +  public static InetSocketAddress getRMWebAddress(Configuration conf, boolean sslEnabled,
String rmId)
    +  {
    +    rmId = (rmId == null) ? "" : ("." + rmId);
    +    InetSocketAddress address;
    +    if (sslEnabled) {
    +      address = conf.getSocketAddr(YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS + rmId,
YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_ADDRESS, YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_PORT);
    +    } else {
    +      address = conf.getSocketAddr(YarnConfiguration.RM_WEBAPP_ADDRESS + rmId, YarnConfiguration.DEFAULT_RM_WEBAPP_ADDRESS,
YarnConfiguration.DEFAULT_RM_WEBAPP_PORT);
    +    }
    +    LOG.info("rm webapp address setting {}", address);
    +    LOG.debug("rm setting sources {}", conf.getPropertySources(YarnConfiguration.RM_WEBAPP_ADDRESS));
    +    address = NetUtils.getConnectAddress(address);
    +    InetAddress resolved = address.getAddress();
    +    if (resolved == null || resolved.isAnyLocalAddress() || resolved.isLoopbackAddress())
{
    +      try {
    +        address = new InetSocketAddress(InetAddress.getLocalHost(), address.getPort());
    +      } catch (UnknownHostException e) {
    +        //Ignore and fallback.
    +      }
    +    }
    +    return address;
    +  }
    +
    +  public static String getSocketConnectString(InetSocketAddress socketAddress)
    +  {
    +    String host;
    +    InetAddress address = socketAddress.getAddress();
    +    if (address.isAnyLocalAddress() || address.isLoopbackAddress()) {
    --- End diff --
    
    Do either of these two
    
    1. Add address.equals(InetAddress.getLocalHost()) to the check as a local inet address
may still not match the two specified conditions above.
    2. Create an unresolved InetSocketAddress in getRMWebAddress with canonical hostname and
check for null InetAddress here


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message