8151444: JDP not working
authordsamersoff
Wed, 23 Mar 2016 21:40:20 +0300
changeset 37324 78e60b834fa4
parent 37323 e41872ef1390
child 37325 22145b2d3616
8151444: JDP not working Summary: Don't set IP_MULTICAST_IF explicitly Reviewed-by: sla, ysuenaga
jdk/src/java.management/share/classes/sun/management/jdp/JdpBroadcaster.java
jdk/test/sun/management/jdp/JdpDefaultsTest.java
jdk/test/sun/management/jdp/JdpTestCase.java
--- a/jdk/src/java.management/share/classes/sun/management/jdp/JdpBroadcaster.java	Tue Mar 22 21:27:55 2016 +0000
+++ b/jdk/src/java.management/share/classes/sun/management/jdp/JdpBroadcaster.java	Wed Mar 23 21:40:20 2016 +0300
@@ -99,30 +99,7 @@
                 throw new JdpException("Unable to bind to source address");
             }
             channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, interf);
-        } else {
-            Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces();
-            boolean succeed = false;
-
-            while (nics.hasMoreElements()) {
-                NetworkInterface nic = nics.nextElement();
-
-                if (nic.isUp() && nic.supportsMulticast()) {
-                    try {
-                        channel.setOption(StandardSocketOptions.IP_MULTICAST_IF, nic);
-                        succeed = true;
-                    } catch (IOException ex) {
-                        // pass
-                    }
-                }
-
-            }
-
-            if (!succeed) {
-                throw new JdpException("Unable to bind to any interfaces.");
-            }
-
         }
-
     }
 
     /**
--- a/jdk/test/sun/management/jdp/JdpDefaultsTest.java	Tue Mar 22 21:27:55 2016 +0000
+++ b/jdk/test/sun/management/jdp/JdpDefaultsTest.java	Wed Mar 23 21:40:20 2016 +0300
@@ -57,7 +57,6 @@
                 "-Dcom.sun.management.jmxremote.autodiscovery=true",
                 "-Dcom.sun.management.jdp.pause=1",
                 "-Dcom.sun.management.jdp.name=" + jdpName,
-                "-Dcom.sun.management.jdp.address=224.0.23.178",
                 "-Djava.util.logging.SimpleFormatter.format='%1$tF %1$tT %4$-7s %5$s %n'",
                 testName
         };
--- a/jdk/test/sun/management/jdp/JdpTestCase.java	Tue Mar 22 21:27:55 2016 +0000
+++ b/jdk/test/sun/management/jdp/JdpTestCase.java	Wed Mar 23 21:40:20 2016 +0300
@@ -122,7 +122,7 @@
      */
     private void jdpPacketReceived(Map<String, String> payload) throws Exception {
         final String instanceName = payload.get("INSTANCE_NAME");
-        if (instanceName.equals(connection.instanceName)) {
+        if (instanceName != null && instanceName.equals(connection.instanceName)) {
             packetFromThisVMReceived(payload);
         } else {
             packetFromOtherVMReceived(payload);