@Override public void writeObject(ObjectOutput output, ClientMapping mapping) throws IOException { byte[] address = mapping.getSourceNetworkAddress().getAddress(); IndexSerializer.UNSIGNED_BYTE.writeInt(output, address.length); output.write(address); IndexSerializer.UNSIGNED_BYTE.writeInt(output, mapping.getSourceNetworkMaskBits()); output.writeUTF(mapping.getDestinationAddress()); IndexSerializer.UNSIGNED_SHORT.writeInt(output, mapping.getDestinationPort()); }
private ClusterTopologyListener.ClusterInfo getClusterInfo(final Map<String, List<ClientMapping>> entries) { final List<ClusterTopologyListener.NodeInfo> nodeInfoList = new ArrayList<>(entries.size()); for (Map.Entry<String, List<ClientMapping>> entry : entries.entrySet()) { final String nodeName = entry.getKey(); final List<ClientMapping> clientMappingList = entry.getValue(); final List<ClusterTopologyListener.MappingInfo> mappingInfoList = new ArrayList<>(clientMappingList.size()); for (ClientMapping clientMapping : clientMappingList) { try { if (InetAddress.getByName(clientMapping.getDestinationAddress()).isAnyLocalAddress()) { EjbLogger.REMOTE_LOGGER.clusteredEJBsBoundToINADDRANY(nodeName, clientMapping.getDestinationAddress()); } } catch (UnknownHostException e) { // ignore } mappingInfoList.add(new ClusterTopologyListener.MappingInfo( clientMapping.getDestinationAddress(), clientMapping.getDestinationPort(), clientMapping.getSourceNetworkAddress(), clientMapping.getSourceNetworkMaskBits()) ); } nodeInfoList.add(new ClusterTopologyListener.NodeInfo(nodeName, mappingInfoList)); } return new ClusterTopologyListener.ClusterInfo(this.clientMappingRegistry.getGroup().getName(), nodeInfoList); } }
@Override public void writeObject(ObjectOutput output, ClientMapping mapping) throws IOException { byte[] address = mapping.getSourceNetworkAddress().getAddress(); IndexSerializer.UNSIGNED_BYTE.writeInt(output, address.length); output.write(address); IndexSerializer.UNSIGNED_BYTE.writeInt(output, mapping.getSourceNetworkMaskBits()); output.writeUTF(mapping.getDestinationAddress()); IndexSerializer.UNSIGNED_SHORT.writeInt(output, mapping.getDestinationPort()); }
final InetAddress clientNetworkAddress = clientMapping.getSourceNetworkAddress();
ClientMapping resolvedClientMapping = null; for (final ClientMapping clientMapping : clientMappings) { final InetAddress sourceNetworkAddress = clientMapping.getSourceNetworkAddress(); final int netMask = clientMapping.getSourceNetworkMaskBits(); final boolean match = NetworkUtil.belongsToNetwork(bindAddress, sourceNetworkAddress, (byte) (netMask & 0xff));