use of com.hazelcast.spi.discovery.multicast.impl.MulticastDiscoverySender in project hazelcast by hazelcast.
the class MulticastDiscoveryStrategy method initializeMulticastSocket.
private void initializeMulticastSocket() {
try {
int port = getOrDefault(MulticastProperties.PORT, DEFAULT_MULTICAST_PORT);
PortValueValidator validator = new PortValueValidator();
validator.validate(port);
String group = getOrDefault(MulticastProperties.GROUP, DEFAULT_MULTICAST_GROUP);
multicastSocket = new MulticastSocket(null);
multicastSocket.bind(new InetSocketAddress(port));
multicastSocket.setReuseAddress(true);
multicastSocket.setTimeToLive(SOCKET_TIME_TO_LIVE);
multicastSocket.setReceiveBufferSize(DATA_OUTPUT_BUFFER_SIZE);
multicastSocket.setSendBufferSize(DATA_OUTPUT_BUFFER_SIZE);
multicastSocket.setSoTimeout(SOCKET_TIMEOUT);
multicastSocket.joinGroup(InetAddress.getByName(group));
multicastDiscoverySender = new MulticastDiscoverySender(discoveryNode, multicastSocket, logger, group, port);
multicastDiscoveryReceiver = new MulticastDiscoveryReceiver(multicastSocket, logger);
if (discoveryNode != null) {
isClient = false;
}
} catch (Exception e) {
logger.finest(e.getMessage());
rethrow(e);
}
}
Aggregations