if (jobManagerAddress != null && !jobManagerAddress.isEmpty()) { try { return ConnectionUtils.findConnectingAddress( new InetSocketAddress(jobManagerAddress, jobManagerPort), deploy.getResponseTimeout(),
if (tryToConnect(localhostName, targetAddress, strategy.getTimeout(), logging)) { LOG.debug("Using InetAddress.getLocalHost() immediately for the connecting address"); if (hasCommonPrefix(targetAddressBytes, interfaceAddress.getAddress())) { LOG.debug("Target address {} and local address {} share prefix - trying to connect.", targetAddress, interfaceAddress); if (tryToConnect(interfaceAddress, targetAddress, strategy.getTimeout(), logging)) { return tryLocalHostBeforeReturning(interfaceAddress, targetAddress, logging); targetAddress, interfaceAddress, strategy.getTimeout()); if (tryToConnect(interfaceAddress, targetAddress, strategy.getTimeout(), logging)) { return tryLocalHostBeforeReturning(interfaceAddress, targetAddress, logging);
/** * 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 (preliminaryResult.equals(localhostName)) { // preliminary result is equal to the local host name return preliminaryResult; } else if (tryToConnect(localhostName, targetAddress, AddressDetectionState.SLOW_CONNECT.getTimeout(), logging)) { // success, we were able to use local host to connect LOG.debug("Preferring {} (InetAddress.getLocalHost()) for local bind point over previous candidate {}", localhostName, preliminaryResult); return localhostName; } else { // we have to make the preliminary result the final result return preliminaryResult; } }
if (tryToConnect(localhostName, targetAddress, strategy.getTimeout(), logging)) { LOG.debug("Using InetAddress.getLocalHost() immediately for the connecting address"); if (hasCommonPrefix(targetAddressBytes, interfaceAddress.getAddress())) { LOG.debug("Target address {} and local address {} share prefix - trying to connect.", targetAddress, interfaceAddress); if (tryToConnect(interfaceAddress, targetAddress, strategy.getTimeout(), logging)) { return tryLocalHostBeforeReturning(interfaceAddress, targetAddress, logging); targetAddress, interfaceAddress, strategy.getTimeout()); if (tryToConnect(interfaceAddress, targetAddress, strategy.getTimeout(), logging)) { return tryLocalHostBeforeReturning(interfaceAddress, targetAddress, logging);
/** * 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 (preliminaryResult.equals(localhostName)) { // preliminary result is equal to the local host name return preliminaryResult; } else if (tryToConnect(localhostName, targetAddress, AddressDetectionState.SLOW_CONNECT.getTimeout(), logging)) { // success, we were able to use local host to connect LOG.debug("Preferring {} (InetAddress.getLocalHost()) for local bind point over previous candidate {}", localhostName, preliminaryResult); return localhostName; } else { // we have to make the preliminary result the final result return preliminaryResult; } }
if (tryToConnect(localhostName, targetAddress, strategy.getTimeout(), logging)) { LOG.debug("Using InetAddress.getLocalHost() immediately for the connecting address"); if (hasCommonPrefix(targetAddressBytes, interfaceAddress.getAddress())) { LOG.debug("Target address {} and local address {} share prefix - trying to connect.", targetAddress, interfaceAddress); if (tryToConnect(interfaceAddress, targetAddress, strategy.getTimeout(), logging)) { return tryLocalHostBeforeReturning(interfaceAddress, targetAddress, logging); targetAddress, interfaceAddress, strategy.getTimeout()); if (tryToConnect(interfaceAddress, targetAddress, strategy.getTimeout(), logging)) { return tryLocalHostBeforeReturning(interfaceAddress, targetAddress, logging);
/** * 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 (preliminaryResult.equals(localhostName)) { // preliminary result is equal to the local host name return preliminaryResult; } else if (tryToConnect(localhostName, targetAddress, AddressDetectionState.SLOW_CONNECT.getTimeout(), logging)) { // success, we were able to use local host to connect LOG.debug("Preferring {} (InetAddress.getLocalHost()) for local bind point over previous candidate {}", localhostName, preliminaryResult); return localhostName; } else { // we have to make the preliminary result the final result return preliminaryResult; } }
int port = ((RemoteStreamEnvironment) env).getPort(); try { clientAddress = ConnectionUtils.findConnectingAddress(new InetSocketAddress(host, port), 2000, 400);
if (tryToConnect(localhostName, targetAddress, strategy.getTimeout(), logging)) { LOG.debug("Using InetAddress.getLocalHost() immediately for the connecting address"); if (hasCommonPrefix(targetAddressBytes, interfaceAddress.getAddress())) { LOG.debug("Target address {} and local address {} share prefix - trying to connect.", targetAddress, interfaceAddress); if (tryToConnect(interfaceAddress, targetAddress, strategy.getTimeout(), logging)) { return tryLocalHostBeforeReturning(interfaceAddress, targetAddress, logging); targetAddress, interfaceAddress, strategy.getTimeout()); if (tryToConnect(interfaceAddress, targetAddress, strategy.getTimeout(), logging)) { return tryLocalHostBeforeReturning(interfaceAddress, targetAddress, logging);
/** * 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 (preliminaryResult.equals(localhostName)) { // preliminary result is equal to the local host name return preliminaryResult; } else if (tryToConnect(localhostName, targetAddress, AddressDetectionState.SLOW_CONNECT.getTimeout(), logging)) { // success, we were able to use local host to connect LOG.debug("Preferring {} (InetAddress.getLocalHost()) for local bind point over previous candidate {}", localhostName, preliminaryResult); return localhostName; } else { // we have to make the preliminary result the final result return preliminaryResult; } }
int port = ((RemoteStreamEnvironment) env).getPort(); try { clientAddress = ConnectionUtils.findConnectingAddress(new InetSocketAddress(host, port), 2000, 400);
int port = ((RemoteStreamEnvironment) env).getPort(); try { clientAddress = ConnectionUtils.findConnectingAddress(new InetSocketAddress(host, port), 2000, 400);