Class DatagramChannelFactoryImpl

java.lang.Object
org.jboss.modcluster.advertise.impl.DatagramChannelFactoryImpl
All Implemented Interfaces:
DatagramChannelFactory

public class DatagramChannelFactoryImpl extends Object implements DatagramChannelFactory
On Linux-like systems, we attempt to avoid cross-talk problem by binding the DatagramChannel to the multicast address, if possible. If not possible, default to binding only to the port. See {@link <a href="https://issues.redhat.com/browse/JGRP-777">JGRP-777</a>}.

On Windows-like systems, we do not attempt to bind the socket to the multicast address, we only bind to the port.

On BSD-like systems (e.g. OS X) we also need to bind the DatagramChannel to the multicast address. If httpd with mod_proxy_cluster (which is bound to the multicast address) is running on the same system, the AdvertiseListener would not be able to bind to any address (i.e. only binding to the port without the address) because JDK does not expose SO_REUSEPORT as a socket option which would be required for this to work. This is to be supported since JDK 9. See {@link <a href="https://bugs.openjdk.java.net/browse/JDK-6432031">JDK-6432031</a>}.

Author:
Paul Ferraro, Radoslav Husar