Assert.assertEquals(host + ":" + port, NetUtils.unresolvedHostAndPortToNormalizedString(host, port)); Assert.assertEquals("[2001:db8:85a3::8a2e:370:7334]:" + port, NetUtils.unresolvedHostAndPortToNormalizedString(host, port)); Assert.assertEquals(host + ":" + port, NetUtils.unresolvedHostAndPortToNormalizedString(host, port)); Assert.assertEquals(host.trim() + ":" + port, NetUtils.unresolvedHostAndPortToNormalizedString(host, port)); int port = 42; try { NetUtils.unresolvedHostAndPortToNormalizedString(host, port); fail(); } catch (Exception ignored) {} NetUtils.unresolvedHostAndPortToNormalizedString(host, port); fail(); } catch (Exception ignored) {} int port = -1; try { NetUtils.unresolvedHostAndPortToNormalizedString(host, port); fail(); } catch (Exception ignored) {} Assert.assertEquals(host.toLowerCase() + ":" + port, NetUtils.unresolvedHostAndPortToNormalizedString(host, port));
boolean enlargeThreadPool) throws Exception { String hostPortUrl = NetUtils.unresolvedHostAndPortToNormalizedString(listeningAddress, listeningPort); logger.info("Trying to start actor system at {}", hostPortUrl);
/** * @param hostname The hostname or address where the target RPC service is listening. * @param port The port where the target RPC service is listening. * @param endpointName The name of the RPC endpoint. * @param addressResolution Whether to try address resolution of the given hostname or not. * This allows to fail fast in case that the hostname cannot be resolved. * @param akkaProtocol True, if security/encryption is enabled, false otherwise. * * @return The RPC URL of the specified RPC endpoint. */ public static String getRpcUrl( String hostname, int port, String endpointName, HighAvailabilityServicesUtils.AddressResolution addressResolution, AkkaProtocol akkaProtocol) throws UnknownHostException { checkNotNull(hostname, "hostname is null"); checkNotNull(endpointName, "endpointName is null"); checkArgument(port > 0 && port <= 65535, "port must be in [1, 65535]"); final String protocolPrefix = akkaProtocol == AkkaProtocol.SSL_TCP ? AKKA_SSL_TCP : AKKA_TCP; if (addressResolution == AddressResolution.TRY_ADDRESS_RESOLUTION) { // Fail fast if the hostname cannot be resolved //noinspection ResultOfMethodCallIgnored InetAddress.getByName(hostname); } final String hostPort = NetUtils.unresolvedHostAndPortToNormalizedString(hostname, port); return String.format("%s://flink@%s/user/%s", protocolPrefix, hostPort, endpointName); }
ActorSystemExecutorConfiguration actorSystemExecutorConfiguration) throws Exception { String hostPortUrl = NetUtils.unresolvedHostAndPortToNormalizedString(listeningAddress, listeningPort); logger.info("Trying to start actor system at {}", hostPortUrl);
ActorSystemExecutorConfiguration actorSystemExecutorConfiguration) throws Exception { String hostPortUrl = NetUtils.unresolvedHostAndPortToNormalizedString(listeningAddress, listeningPort); logger.info("Trying to start actor system at {}", hostPortUrl);
/** * @param hostname The hostname or address where the target RPC service is listening. * @param port The port where the target RPC service is listening. * @param endpointName The name of the RPC endpoint. * @param addressResolution Whether to try address resolution of the given hostname or not. * This allows to fail fast in case that the hostname cannot be resolved. * @param akkaProtocol True, if security/encryption is enabled, false otherwise. * * @return The RPC URL of the specified RPC endpoint. */ public static String getRpcUrl( String hostname, int port, String endpointName, HighAvailabilityServicesUtils.AddressResolution addressResolution, AkkaProtocol akkaProtocol) throws UnknownHostException { checkNotNull(hostname, "hostname is null"); checkNotNull(endpointName, "endpointName is null"); checkArgument(port > 0 && port <= 65535, "port must be in [1, 65535]"); final String protocolPrefix = akkaProtocol == AkkaProtocol.SSL_TCP ? AKKA_SSL_TCP : AKKA_TCP; if (addressResolution == AddressResolution.TRY_ADDRESS_RESOLUTION) { // Fail fast if the hostname cannot be resolved //noinspection ResultOfMethodCallIgnored InetAddress.getByName(hostname); } final String hostPort = NetUtils.unresolvedHostAndPortToNormalizedString(hostname, port); return String.format("%s://flink@%s/user/%s", protocolPrefix, hostPort, endpointName); }
/** * * @param hostname The hostname or address where the target RPC service is listening. * @param port The port where the target RPC service is listening. * @param endpointName The name of the RPC endpoint. * @param addressResolution Whether to try address resolution of the given hostname or not. * This allows to fail fast in case that the hostname cannot be resolved. * @param akkaProtocol True, if security/encryption is enabled, false otherwise. * * @return The RPC URL of the specified RPC endpoint. */ public static String getRpcUrl( String hostname, int port, String endpointName, HighAvailabilityServicesUtils.AddressResolution addressResolution, AkkaProtocol akkaProtocol) throws UnknownHostException { checkNotNull(hostname, "hostname is null"); checkNotNull(endpointName, "endpointName is null"); checkArgument(port > 0 && port <= 65535, "port must be in [1, 65535]"); final String protocolPrefix = akkaProtocol == AkkaProtocol.SSL_TCP ? AkKA_SSL_TCP : AKKA_TCP; if (addressResolution == AddressResolution.TRY_ADDRESS_RESOLUTION) { // Fail fast if the hostname cannot be resolved //noinspection ResultOfMethodCallIgnored InetAddress.getByName(hostname); } final String hostPort = NetUtils.unresolvedHostAndPortToNormalizedString(hostname, port); return String.format("%s://flink@%s/user/%s", protocolPrefix, hostPort, endpointName); }
/** * * @param hostname The hostname or address where the target RPC service is listening. * @param port The port where the target RPC service is listening. * @param endpointName The name of the RPC endpoint. * @param addressResolution Whether to try address resolution of the given hostname or not. * This allows to fail fast in case that the hostname cannot be resolved. * @param akkaProtocol True, if security/encryption is enabled, false otherwise. * * @return The RPC URL of the specified RPC endpoint. */ public static String getRpcUrl( String hostname, int port, String endpointName, HighAvailabilityServicesUtils.AddressResolution addressResolution, AkkaProtocol akkaProtocol) throws UnknownHostException { checkNotNull(hostname, "hostname is null"); checkNotNull(endpointName, "endpointName is null"); checkArgument(port > 0 && port <= 65535, "port must be in [1, 65535]"); final String protocolPrefix = akkaProtocol == AkkaProtocol.SSL_TCP ? AKKA_SSL_TCP : AKKA_TCP; if (addressResolution == AddressResolution.TRY_ADDRESS_RESOLUTION) { // Fail fast if the hostname cannot be resolved //noinspection ResultOfMethodCallIgnored InetAddress.getByName(hostname); } final String hostPort = NetUtils.unresolvedHostAndPortToNormalizedString(hostname, port); return String.format("%s://flink@%s/user/%s", protocolPrefix, hostPort, endpointName); }
LOG.info("Starting AkkaRpcService at {}.", NetUtils.unresolvedHostAndPortToNormalizedString(hostname, port));