private MulticastService(Node node, MulticastSocket multicastSocket) throws Exception { this.logger = node.getLogger(MulticastService.class.getName()); this.node = node; this.multicastSocket = multicastSocket; NodeIOService nodeIOService = new NodeIOService(node, node.nodeEngine); this.inputProcessor = node.getNodeExtension().createMulticastInputProcessor(nodeIOService); this.outputProcessor = node.getNodeExtension().createMulticastOutputProcessor(nodeIOService); this.sendOutput = node.getSerializationService().createObjectDataOutput(SEND_OUTPUT_SIZE); Config config = node.getConfig(); MulticastConfig multicastConfig = config.getNetworkConfig().getJoin().getMulticastConfig(); this.datagramPacketSend = new DatagramPacket(new byte[0], 0, InetAddress.getByName(multicastConfig.getMulticastGroup()), multicastConfig.getMulticastPort()); this.datagramPacketReceive = new DatagramPacket(new byte[DATAGRAM_BUFFER_SIZE], DATAGRAM_BUFFER_SIZE); Set<String> trustedInterfaces = multicastConfig.getTrustedInterfaces(); ILogger logger = node.getLogger(JoinMessageTrustChecker.class); joinMessageTrustChecker = new JoinMessageTrustChecker(trustedInterfaces, logger); }
private MulticastService(Node node, MulticastSocket multicastSocket) throws Exception { this.logger = node.getLogger(MulticastService.class.getName()); this.node = node; this.multicastSocket = multicastSocket; NodeIOService nodeIOService = new NodeIOService(node, node.nodeEngine); this.inputProcessor = node.getNodeExtension().createMulticastInputProcessor(nodeIOService); this.outputProcessor = node.getNodeExtension().createMulticastOutputProcessor(nodeIOService); this.sendOutput = node.getSerializationService().createObjectDataOutput(SEND_OUTPUT_SIZE); Config config = node.getConfig(); MulticastConfig multicastConfig = config.getNetworkConfig().getJoin().getMulticastConfig(); this.datagramPacketSend = new DatagramPacket(new byte[0], 0, InetAddress.getByName(multicastConfig.getMulticastGroup()), multicastConfig.getMulticastPort()); this.datagramPacketReceive = new DatagramPacket(new byte[DATAGRAM_BUFFER_SIZE], DATAGRAM_BUFFER_SIZE); Set<String> trustedInterfaces = multicastConfig.getTrustedInterfaces(); ILogger logger = node.getLogger(JoinMessageTrustChecker.class); joinMessageTrustChecker = new JoinMessageTrustChecker(trustedInterfaces, logger); }
multicastSocket.setReuseAddress(true); multicastSocket.bind(new InetSocketAddress(multicastConfig.getMulticastPort())); multicastSocket.setTimeToLive(multicastConfig.getMulticastTimeToLive()); try {
private static void multicastConfigXmlGenerator(XmlGenerator gen, JoinConfig join) { MulticastConfig mcConfig = join.getMulticastConfig(); gen.open("multicast", "enabled", mcConfig.isEnabled(), "loopbackModeEnabled", mcConfig.isLoopbackModeEnabled()) .node("multicast-group", mcConfig.getMulticastGroup()) .node("multicast-port", mcConfig.getMulticastPort()) .node("multicast-timeout-seconds", mcConfig.getMulticastTimeoutSeconds()) .node("multicast-time-to-live", mcConfig.getMulticastTimeToLive()); if (!mcConfig.getTrustedInterfaces().isEmpty()) { gen.open("trusted-interfaces"); for (String trustedInterface : mcConfig.getTrustedInterfaces()) { gen.node("interface", trustedInterface); } gen.close(); } gen.close(); }
multicastSocket.setReuseAddress(true); multicastSocket.bind(new InetSocketAddress(multicastConfig.getMulticastPort())); multicastSocket.setTimeToLive(multicastConfig.getMulticastTimeToLive()); try {
private static void multicastConfigXmlGenerator(XmlGenerator gen, JoinConfig join) { MulticastConfig mcConfig = join.getMulticastConfig(); gen.open("multicast", "enabled", mcConfig.isEnabled(), "loopbackModeEnabled", mcConfig.isLoopbackModeEnabled()) .node("multicast-group", mcConfig.getMulticastGroup()) .node("multicast-port", mcConfig.getMulticastPort()) .node("multicast-timeout-seconds", mcConfig.getMulticastTimeoutSeconds()) .node("multicast-time-to-live", mcConfig.getMulticastTimeToLive()); if (!mcConfig.getTrustedInterfaces().isEmpty()) { gen.open("trusted-interfaces"); for (String trustedInterface : mcConfig.getTrustedInterfaces()) { gen.node("interface", trustedInterface); } gen.close(); } gen.close(); }