mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8224477: java.net socket types new-style socket option methods - spec and impl mismatch
Reviewed-by: alanb
This commit is contained in:
parent
cf48689855
commit
bc24d17e80
18 changed files with 1289 additions and 300 deletions
|
@ -33,6 +33,7 @@ import java.lang.invoke.VarHandle;
|
|||
import java.nio.channels.SocketChannel;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.Collections;
|
||||
|
||||
|
@ -1786,6 +1787,9 @@ class Socket implements java.io.Closeable {
|
|||
* @since 9
|
||||
*/
|
||||
public <T> Socket setOption(SocketOption<T> name, T value) throws IOException {
|
||||
Objects.requireNonNull(name);
|
||||
if (isClosed())
|
||||
throw new SocketException("Socket is closed");
|
||||
getImpl().setOption(name, value);
|
||||
return this;
|
||||
}
|
||||
|
@ -1815,6 +1819,9 @@ class Socket implements java.io.Closeable {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getOption(SocketOption<T> name) throws IOException {
|
||||
Objects.requireNonNull(name);
|
||||
if (isClosed())
|
||||
throw new SocketException("Socket is closed");
|
||||
return getImpl().getOption(name);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue