Skip to content

Commit

Permalink
Minimum Java version now 17 - remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Feb 16, 2023
1 parent 3f7dafd commit 2f94c7b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.net.MulticastSocket;
import java.net.NetworkInterface;
import java.net.SocketTimeoutException;
import java.net.StandardSocketOptions;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicBoolean;

Expand All @@ -34,7 +35,6 @@
import org.apache.catalina.tribes.MessageListener;
import org.apache.catalina.tribes.io.ChannelData;
import org.apache.catalina.tribes.io.XByteBuffer;
import org.apache.catalina.tribes.util.JreCompat;
import org.apache.catalina.tribes.util.StringManager;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
Expand Down Expand Up @@ -220,7 +220,7 @@ protected void setupSocket() throws IOException {
socket = new MulticastSocket(port);
}
// Hint if we want disable loop back(local machine) messages
JreCompat.getInstance().setSocketoptionIpMulticastLoop(socket, !localLoopbackDisabled);
socket.setOption(StandardSocketOptions.IP_MULTICAST_LOOP, Boolean.valueOf(!localLoopbackDisabled));
if (mcastBindAddress != null) {
if(log.isInfoEnabled()) {
log.info(sm.getString("mcastServiceImpl.setInterface", mcastBindAddress));
Expand Down
60 changes: 0 additions & 60 deletions java/org/apache/catalina/tribes/util/Jre14Compat.java

This file was deleted.

55 changes: 0 additions & 55 deletions java/org/apache/catalina/tribes/util/JreCompat.java

This file was deleted.

7 changes: 3 additions & 4 deletions test/org/apache/catalina/tribes/TesterMulticast.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.MulticastSocket;
import java.net.StandardSocketOptions;
import java.net.UnknownHostException;

import org.apache.catalina.tribes.util.JreCompat;

/**
* A simple multicast test that replicates the core elements of Tomcat's
* multicast membership. If this works then multicast membership should work.
Expand Down Expand Up @@ -83,7 +82,7 @@ private static class Rx implements Runnable {
@Override
public void run() {
try (MulticastSocket s = new MulticastSocket(PORT)) {
JreCompat.getInstance().setSocketoptionIpMulticastLoop(s, true);
s.setOption(StandardSocketOptions.IP_MULTICAST_LOOP, Boolean.valueOf(true));
s.joinGroup(new InetSocketAddress(INET_ADDRESS, 0), null);
DatagramPacket p = new DatagramPacket(new byte[4], 4);
p.setAddress(INET_ADDRESS);
Expand All @@ -110,7 +109,7 @@ private static class Tx implements Runnable {
@Override
public void run() {
try (MulticastSocket s = new MulticastSocket(PORT)) {
JreCompat.getInstance().setSocketoptionIpMulticastLoop(s, true);
s.setOption(StandardSocketOptions.IP_MULTICAST_LOOP, Boolean.valueOf(true));
s.joinGroup(new InetSocketAddress(INET_ADDRESS, 0), null);
DatagramPacket p = new DatagramPacket(new byte[4], 4);
p.setAddress(INET_ADDRESS);
Expand Down

0 comments on commit 2f94c7b

Please sign in to comment.