Search in sources :

Example 1 with ClientMapping

use of org.jboss.as.network.ClientMapping in project wildfly by wildfly.

the class AssociationImpl method getClusterInfo.

ClusterTopologyListener.ClusterInfo getClusterInfo(final Map<String, List<ClientMapping>> added, final String clusterName) {
    final List<ClusterTopologyListener.NodeInfo> nodeInfoList = new ArrayList<>(added.size());
    for (Map.Entry<String, List<ClientMapping>> entry : added.entrySet()) {
        final String nodeName = entry.getKey();
        final List<ClientMapping> clientMappingList = entry.getValue();
        final List<ClusterTopologyListener.MappingInfo> mappingInfoList = new ArrayList<>();
        for (ClientMapping clientMapping : clientMappingList) {
            mappingInfoList.add(new ClusterTopologyListener.MappingInfo(clientMapping.getDestinationAddress(), clientMapping.getDestinationPort(), clientMapping.getSourceNetworkAddress(), clientMapping.getSourceNetworkMaskBits()));
        }
        nodeInfoList.add(new ClusterTopologyListener.NodeInfo(nodeName, mappingInfoList));
    }
    return new ClusterTopologyListener.ClusterInfo(clusterName, nodeInfoList);
}
Also used : ClusterTopologyListener(org.jboss.ejb.server.ClusterTopologyListener) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) ClientMapping(org.jboss.as.network.ClientMapping) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with ClientMapping

use of org.jboss.as.network.ClientMapping in project wildfly by wildfly.

the class EJBRemotingConnectorClientMappingsEntryProviderService method getClientMappings.

List<ClientMapping> getClientMappings() {
    final List<ClientMapping> ret = new ArrayList<>();
    RemotingConnectorBindingInfoService.RemotingConnectorInfo info = this.remotingConnectorInfo.getValue();
    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;
}
Also used : UnknownHostException(java.net.UnknownHostException) RemotingConnectorBindingInfoService(org.jboss.as.remoting.RemotingConnectorBindingInfoService) ArrayList(java.util.ArrayList) ClientMapping(org.jboss.as.network.ClientMapping) InetAddress(java.net.InetAddress)

Aggregations

ArrayList (java.util.ArrayList)2 ClientMapping (org.jboss.as.network.ClientMapping)2 InetAddress (java.net.InetAddress)1 UnknownHostException (java.net.UnknownHostException)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 RemotingConnectorBindingInfoService (org.jboss.as.remoting.RemotingConnectorBindingInfoService)1 ClusterTopologyListener (org.jboss.ejb.server.ClusterTopologyListener)1