Hi all, Thank you so much, Dmitry!
I've created webrev for it. http://cr.openjdk.java.net/~ysuenaga/JDK-8057556/webrev.0/ Please review. Thanks, Yasumasa (2014/09/04 21:26), Dmitry Samersoff wrote: > Yasumasa, > > The CR number is JDK-8057556 > > I'll care about it's integration. > > -Dmitry > > On 2014-09-02 18:52, Yasumasa Suenaga wrote: >> Hi all, >> >> I'm trying to use JDP on my Fedora20 machine. >> My machine has two NICs and only one NIC is up. >> >> I passed system properties as below, however JDP broadcaster >> thread was not started: >> >> -Dcom.sun.management.jmxremote.port=7091 >> -Dcom.sun.management.jmxremote.authenticate=false >> -Dcom.sun.management.jmxremote.ssl=false >> -Dcom.sun.management.jmxremote.autodiscovery=true >> -Dcom.sun.management.jdp.name=TEST >> >> I checked exceptions with jdb, SocketException was occurred in >> JDPControllerRunner#run(), and it was caused by another NIC >> is down. >> >> Currently, DiagramChannel which is used in JDPBroadcaster >> tries to send JDP packet through all "UP" NICs. >> However, NIC which is controlled by NetworkManager seems to >> be still "UP" when ifdown command is executed. >> (It seems to be removed IP address from NIC only.) >> >> >> This problem may be Fedora, however I think it should be >> improved in JDK. >> I've created a patch as below, and it works fine in my environment. >> (jdk9/dev/jdk) >> >> If this patch may be accepted, I will file this to JBS. >> >> -------------------- >> diff -r 68a6bb51cb26 >> src/java.management/share/classes/sun/management/jdp/JdpBroadcaster.java >> --- >> a/src/java.management/share/classes/sun/management/jdp/JdpBroadcaster.java >> Mon Sep 01 13:33:28 2014 +0200 >> +++ >> b/src/java.management/share/classes/sun/management/jdp/JdpBroadcaster.java >> Tue Sep 02 23:25:50 2014 +0900 >> @@ -35,6 +35,7 @@ >> import java.nio.ByteBuffer; >> import java.nio.channels.DatagramChannel; >> import java.nio.channels.UnsupportedAddressTypeException; >> +import java.util.Enumeration; >> >> /** >> * JdpBroadcaster is responsible for sending pre-built JDP packet across a >> Net >> @@ -79,6 +80,15 @@ >> if (srcAddress != null) { >> // User requests particular interface to bind to >> NetworkInterface interf = >> NetworkInterface.getByInetAddress(srcAddress); >> + >> + if (interf == null) { >> + throw new JdpException("Unable to get network interface for >> " + srcAddress.toString()); >> + } >> + >> + if (!interf.isUp() || !interf.supportsMulticast()) { >> + throw new JdpException(interf.getName() + " does not >> support multicast."); >> + } >> + >> try { >> channel.bind(new InetSocketAddress(srcAddress, 0)); >> } catch (UnsupportedAddressTypeException ex) { >> @@ -86,6 +96,23 @@ >> } >> channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, >> interf); >> } >> + else { >> + Enumeration<NetworkInterface> nics = >> NetworkInterface.getNetworkInterfaces(); >> + while (nics.hasMoreElements()) { >> + NetworkInterface nic = nics.nextElement(); >> + >> + if (nic.isUp() && nic.supportsMulticast()) { >> + try { >> + >> channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, nic); >> + } catch (IOException ex) { >> + System.err.println("WARNING: JDP broadcaster cannot >> use " + nic.getName() + ": " + ex.getMessage()); >> + } >> + } >> + >> + } >> + >> + } >> + >> } >> >> /** >> -------------------- >> >> >> Thanks, >> >> Yasumasa >> > >