Github user StephanEwen commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1361#discussion_r45052228
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/net/ConnectionUtils.java 
---
    @@ -180,7 +180,41 @@ public static InetAddress 
findConnectingAddress(InetSocketAddress targetAddress,
                }
        }
     
    +   /**
    +    * This utility method tries to connect to the JobManager using the 
InetAddress returned by
    +    * InetAddress.getLocalHost(). The purpose of the utility is to have a 
final try connecting to
    +    * the target address using the LocalHost before using the address 
returned.
    +    * We do a second try because the JM might have been unavailable during 
the first check.
    +    *
    +    * @param preliminaryResult The address detected by the heuristic
    +    * @return either the preliminaryResult or the address returned by 
InetAddress.getLocalHost() (if
    +    *                      we are able to connect to targetAddress from 
there)
    +    */
    +   private static InetAddress tryLocalHostBeforeReturning(InetAddress 
preliminaryResult, SocketAddress targetAddress, boolean logging) throws 
IOException {
    +           InetAddress localhostName = InetAddress.getLocalHost();
    +           if(tryToConnect(localhostName, targetAddress, 
AddressDetectionState.LOCAL_HOST.getTimeout(), logging)) {
    --- End diff --
    
    Also: code style, space


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to