Skip to content

Commit

Permalink
8332181: Deprecate for removal the MulticastSocket.send(DatagramPacke…
Browse files Browse the repository at this point in the history
…t, byte) and setTTL/getTTL methods on DatagramSocketImpl and MulticastSocket

Reviewed-by: dfuchs, iris, alanb
  • Loading branch information
jaikiran committed May 21, 2024
1 parent f5ab7df commit ce99198
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/java.base/share/classes/java/net/DatagramSocketImpl.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -171,7 +171,7 @@ protected void disconnect() {
* the time-to-live option.
* @see #getTTL()
*/
@Deprecated
@Deprecated(forRemoval = true, since = "1.2")
protected abstract void setTTL(byte ttl) throws IOException;

/**
Expand All @@ -183,7 +183,7 @@ protected void disconnect() {
* @return a byte representing the TTL value
* @see #setTTL(byte)
*/
@Deprecated
@Deprecated(forRemoval = true, since = "1.2")
protected abstract byte getTTL() throws IOException;

/**
Expand Down
8 changes: 4 additions & 4 deletions src/java.base/share/classes/java/net/MulticastSocket.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -226,7 +226,7 @@ public MulticastSocket(SocketAddress bindaddr) throws IOException {
* <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);
}
Expand Down Expand Up @@ -271,7 +271,7 @@ public void setTimeToLive(int ttl) throws IOException {
* 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();
}
Expand Down Expand Up @@ -561,7 +561,7 @@ public boolean getLoopbackMode() throws SocketException {
* @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);
Expand Down
7 changes: 3 additions & 4 deletions src/java.base/share/classes/java/net/NetMulticastSocket.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -650,8 +650,8 @@ public Set<SocketOption<?>> supportedOptions() {
*/
private InetAddress infAddress = null;

@Deprecated
@Override
@SuppressWarnings("removal")
public void setTTL(byte ttl) throws IOException {
if (isClosed())
throw new SocketException("Socket is closed");
Expand All @@ -668,8 +668,8 @@ public void setTimeToLive(int ttl) throws IOException {
getImpl().setTimeToLive(ttl);
}

@Deprecated
@Override
@SuppressWarnings("removal")
public byte getTTL() throws IOException {
if (isClosed())
throw new SocketException("Socket is closed");
Expand Down Expand Up @@ -884,7 +884,6 @@ public boolean getLoopbackMode() throws SocketException {
}

@SuppressWarnings("removal")
@Deprecated
@Override
public void send(DatagramPacket p, byte ttl)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -401,7 +401,7 @@ public Set<SocketOption<?>> supportedOptions() {
private InetAddress outgoingInetAddress;

@Override
@Deprecated
@SuppressWarnings("removal")
public void setTTL(byte ttl) throws IOException {
setTimeToLive(Byte.toUnsignedInt(ttl));
}
Expand All @@ -417,7 +417,7 @@ public void setTimeToLive(int ttl) throws IOException {
}

@Override
@Deprecated
@SuppressWarnings("removal")
public byte getTTL() throws IOException {
return (byte) getTimeToLive();
}
Expand Down Expand Up @@ -592,7 +592,7 @@ public boolean getLoopbackMode() throws SocketException {
}

@Override
@Deprecated
@SuppressWarnings("removal")
public void send(DatagramPacket p, byte ttl) throws IOException {
sendLock.lock();
try {
Expand Down

0 comments on commit ce99198

Please sign in to comment.