8332181: Deprecate for removal the MulticastSocket.send(DatagramPacket, byte) and setTTL/getTTL methods on DatagramSocketImpl and MulticastSocket

Reviewed-by: dfuchs, iris, alanb
This commit is contained in:
Jaikiran Pai 2024-05-21 06:37:15 +00:00
parent f5ab7dff40
commit ce99198e3a
4 changed files with 14 additions and 15 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -171,7 +171,7 @@ public abstract class DatagramSocketImpl implements SocketOptions {
* the time-to-live option.
* @see #getTTL()
*/
@Deprecated
@Deprecated(forRemoval = true, since = "1.2")
protected abstract void setTTL(byte ttl) throws IOException;
/**
@ -183,7 +183,7 @@ public abstract class DatagramSocketImpl implements SocketOptions {
* @return a byte representing the TTL value
* @see #setTTL(byte)
*/
@Deprecated
@Deprecated(forRemoval = true, since = "1.2")
protected abstract byte getTTL() throws IOException;
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -226,7 +226,7 @@ public class MulticastSocket extends DatagramSocket {
* <b>int</b> instead of <b>byte</b> as the type for ttl.
* @see #getTTL()
*/
@Deprecated
@Deprecated(forRemoval = true, since = "1.2")
public void setTTL(byte ttl) throws IOException {
delegate().setTTL(ttl);
}
@ -271,7 +271,7 @@ public class MulticastSocket extends DatagramSocket {
* which returns an <b>int</b> instead of a <b>byte</b>.
* @see #setTTL(byte)
*/
@Deprecated
@Deprecated(forRemoval = true, since = "1.2")
public byte getTTL() throws IOException {
return delegate().getTTL();
}
@ -561,7 +561,7 @@ public class MulticastSocket extends DatagramSocket {
* @see SecurityManager#checkMulticast(java.net.InetAddress, byte)
* @see SecurityManager#checkConnect
*/
@Deprecated
@Deprecated(forRemoval = true, since = "1.4")
public void send(DatagramPacket p, byte ttl)
throws IOException {
delegate().send(p, ttl);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -650,8 +650,8 @@ final class NetMulticastSocket extends MulticastSocket {
*/
private InetAddress infAddress = null;
@Deprecated
@Override
@SuppressWarnings("removal")
public void setTTL(byte ttl) throws IOException {
if (isClosed())
throw new SocketException("Socket is closed");
@ -668,8 +668,8 @@ final class NetMulticastSocket extends MulticastSocket {
getImpl().setTimeToLive(ttl);
}
@Deprecated
@Override
@SuppressWarnings("removal")
public byte getTTL() throws IOException {
if (isClosed())
throw new SocketException("Socket is closed");
@ -884,7 +884,6 @@ final class NetMulticastSocket extends MulticastSocket {
}
@SuppressWarnings("removal")
@Deprecated
@Override
public void send(DatagramPacket p, byte ttl)
throws IOException {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -401,7 +401,7 @@ public class DatagramSocketAdaptor
private InetAddress outgoingInetAddress;
@Override
@Deprecated
@SuppressWarnings("removal")
public void setTTL(byte ttl) throws IOException {
setTimeToLive(Byte.toUnsignedInt(ttl));
}
@ -417,7 +417,7 @@ public class DatagramSocketAdaptor
}
@Override
@Deprecated
@SuppressWarnings("removal")
public byte getTTL() throws IOException {
return (byte) getTimeToLive();
}
@ -592,7 +592,7 @@ public class DatagramSocketAdaptor
}
@Override
@Deprecated
@SuppressWarnings("removal")
public void send(DatagramPacket p, byte ttl) throws IOException {
sendLock.lock();
try {