List<ClientMapping> getClientMappings() { final List<ClientMapping> ret = new ArrayList<>(); RemotingConnectorBindingInfoService.RemotingConnectorInfo info = this.remotingConnectorInfo.get(); if (info.getSocketBinding().getClientMappings() != null && !info.getSocketBinding().getClientMappings().isEmpty()) { ret.addAll(info.getSocketBinding().getClientMappings()); } else { // TODO: We use the textual form of IP address as the destination address for now. // This needs to be configurable (i.e. send either host name or the IP address). But // since this is a corner case (i.e. absence of any client-mappings for a socket binding), // this should be OK for now final String destinationAddress = info.getSocketBinding().getAddress().getHostAddress(); final InetAddress clientNetworkAddress; try { clientNetworkAddress = InetAddress.getByName("::"); } catch (UnknownHostException e) { throw new RuntimeException(e); } final ClientMapping defaultClientMapping = new ClientMapping(clientNetworkAddress, 0, destinationAddress, info.getSocketBinding().getAbsolutePort()); ret.add(defaultClientMapping); } return ret; } }
List<ClientMapping> getClientMappings() { if (this.remotingServer == null) { return Collections.emptyList(); } final SocketBinding socketBinding = this.remotingServer.getSocketBinding(); final List<ClientMapping> clientMappings = socketBinding.getClientMappings(); if (clientMappings != null && !clientMappings.isEmpty()) { return clientMappings; } // TODO: We use the textual form of IP address as the destination address for now. // This needs to be configurable (i.e. send either host name or the IP address). But // since this is a corner case (i.e. absence of any client-mappings for a socket binding), // this should be OK for now final String destinationAddress = socketBinding.getAddress().getHostAddress(); final InetAddress clientNetworkAddress; try { clientNetworkAddress = InetAddress.getByName("::"); } catch (UnknownHostException e) { throw new RuntimeException(e); } final ClientMapping defaultClientMapping = new ClientMapping(clientNetworkAddress, 0, destinationAddress, socketBinding.getAbsolutePort()); return Collections.singletonList(defaultClientMapping); }
throw MessagingLogger.ROOT_LOGGER.failedToFindConnectorSocketBinding(tc.getName()); if (socketBinding.getClientMappings() != null && !socketBinding.getClientMappings().isEmpty()) { ClientMapping clientMapping = socketBinding.getClientMappings().get(0); host = NetworkUtils.canonize(clientMapping.getDestinationAddress()); port = clientMapping.getDestinationPort(); if (socketBinding.getClientMappings().size() > 1) { MessagingLogger.ROOT_LOGGER.multipleClientMappingsFound(socketBinding.getName(), tc.getName(), host, port);
throw MessagingLogger.ROOT_LOGGER.failedToFindConnectorSocketBinding(tc.getName()); if (socketBinding.getClientMappings() != null && !socketBinding.getClientMappings().isEmpty()) { ClientMapping clientMapping = socketBinding.getClientMappings().get(0); host = NetworkUtils.canonize(clientMapping.getDestinationAddress()); port = clientMapping.getDestinationPort(); if (socketBinding.getClientMappings().size() > 1) { MessagingLogger.ROOT_LOGGER.multipleClientMappingsFound(socketBinding.getName(), tc.getName(), host, port);