RFR: 8332623: Remove setTTL()/getTTL() methods from DatagramSocketImpl/MulticastSocket and MulticastSocket.send(DatagramPacket, byte) [v2]
Daniel Fuchs
dfuchs at openjdk.org
Wed Jun 11 11:54:33 UTC 2025
On Wed, 11 Jun 2025 10:42:12 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> Can I please get a review of this change which proposes to remove the deprecated-for-removal methods from `MulticastSocket` and `DatagramSocketImpl`?
>>
>> The following methods on `java.net.MulticastSocket` and `java.net.DatagramSocketImpl`:
>>
>>
>> public void setTTL(byte ttl) throws IOException
>> public byte getTTL() throws IOException
>>
>>
>> and this other one on `MulticastSocket`:
>>
>>
>> public void send(DatagramPacket p, byte ttl) throws IOException
>>
>>
>> have been deprecated for removal since Java 23, through https://bugs.openjdk.org/browse/JDK-8332181. Even before that they have been deprecated since Java 1.2 and Java 1.4.
>>
>> The commit in this PR removes them completely. This PR also removes some tests that were specifically testing the `setTTL()/getTTL()/send(DatagramPacket, byte)` methods. A few other tests have been adjusted to use the alternate `getTimeToLive()/setTimeToLive()` methods where appropriate.
>>
>> Existing tests in tier1, tier2 and tier3 continue to pass with these changes.
>
> Jaikiran Pai has updated the pull request incrementally with three additional commits since the last revision:
>
> - no need to setTimeToLive() in AdaptorMulticasting test
> - undo change to "@summary" of a test
> - remove sendLock
Generally look good. One question on one of the tests.
test/jdk/java/net/DatagramSocket/SendCheck.java line 133:
> 131: Sender.of(DatagramChannel.open().socket()),
> 132: Sender.of((MulticastSocket)
> 133: DatagramChannel.open().socket(), (byte) 0)
Should we instead just remove the ttl parameter and test with plain MulticastSocket::send?
-------------
PR Review: https://git.openjdk.org/jdk/pull/25744#pullrequestreview-2916814072
PR Review Comment: https://git.openjdk.org/jdk/pull/25744#discussion_r2139934428
More information about the nio-dev
mailing list