This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 3136f94352 Replace calls to methods that are deprecated in Java 16+
3136f94352 is described below

commit 3136f943528c4a21a1eb54a22d2cbb4ae8940d8d
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jan 12 19:57:09 2023 +0000

    Replace calls to methods that are deprecated in Java 16+
---
 test/org/apache/catalina/tribes/TesterMulticast.java | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/test/org/apache/catalina/tribes/TesterMulticast.java 
b/test/org/apache/catalina/tribes/TesterMulticast.java
index 32227525c8..3e85687eea 100644
--- a/test/org/apache/catalina/tribes/TesterMulticast.java
+++ b/test/org/apache/catalina/tribes/TesterMulticast.java
@@ -19,6 +19,8 @@ package org.apache.catalina.tribes;
 import java.net.DatagramPacket;
 import java.net.InetAddress;
 import java.net.MulticastSocket;
+import java.net.NetworkInterface;
+import java.net.StandardSocketOptions;
 import java.net.UnknownHostException;
 
 /**
@@ -80,8 +82,9 @@ public class TesterMulticast {
         @Override
         public void run() {
             try (MulticastSocket s = new MulticastSocket(PORT)) {
-                s.setLoopbackMode(false);
-                s.joinGroup(INET_ADDRESS);
+                s.setOption(StandardSocketOptions.IP_MULTICAST_LOOP, 
Boolean.TRUE);
+                NetworkInterface networkInterface = 
NetworkInterface.getByInetAddress(INET_ADDRESS);
+                s.setNetworkInterface(networkInterface);
                 DatagramPacket p = new DatagramPacket(new byte[4], 4);
                 p.setAddress(INET_ADDRESS);
                 p.setPort(PORT);
@@ -107,8 +110,9 @@ public class TesterMulticast {
         @Override
         public void run() {
             try (MulticastSocket s = new MulticastSocket(PORT)) {
-                s.setLoopbackMode(false);
-                s.joinGroup(INET_ADDRESS);
+                s.setOption(StandardSocketOptions.IP_MULTICAST_LOOP, 
Boolean.TRUE);
+                NetworkInterface networkInterface = 
NetworkInterface.getByInetAddress(INET_ADDRESS);
+                s.setNetworkInterface(networkInterface);
                 DatagramPacket p = new DatagramPacket(new byte[4], 4);
                 p.setAddress(INET_ADDRESS);
                 p.setPort(PORT);


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to