8235139: Deprecate the socket impl factory mechanism
Reviewed-by: dfuchs, alanb, chegar
This commit is contained in:
parent
49cf13d2fb
commit
1662373400
@ -1132,7 +1132,18 @@ public class DatagramSocket implements java.io.Closeable {
|
||||
* @see java.net.DatagramSocketImplFactory#createDatagramSocketImpl()
|
||||
* @see SecurityManager#checkSetFactory
|
||||
* @since 1.3
|
||||
*
|
||||
* @deprecated Use {@link DatagramChannel}, or subclass {@code DatagramSocket}
|
||||
* directly.
|
||||
* <br> This method provided a way in early JDK releases to replace the
|
||||
* system wide implementation of {@code DatagramSocket}. It has been mostly
|
||||
* obsolete since Java 1.4. If required, a {@code DatagramSocket} can be
|
||||
* created to use a custom implementation by extending {@code DatagramSocket}
|
||||
* and using the {@linkplain #DatagramSocket(DatagramSocketImpl) protected
|
||||
* constructor} that takes an {@linkplain DatagramSocketImpl implementation}
|
||||
* as a parameter.
|
||||
*/
|
||||
@Deprecated(since = "17")
|
||||
public static synchronized void
|
||||
setDatagramSocketImplFactory(DatagramSocketImplFactory fac)
|
||||
throws IOException
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2021, 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
|
||||
@ -41,10 +41,7 @@ import sun.net.PlatformSocketImpl;
|
||||
* based on that request, and then possibly returns a result to the requester.
|
||||
* <p>
|
||||
* The actual work of the server socket is performed by an instance
|
||||
* of the {@code SocketImpl} class. An application can
|
||||
* change the socket factory that creates the socket
|
||||
* implementation to configure itself to create sockets
|
||||
* appropriate to the local firewall.
|
||||
* of the {@code SocketImpl} class.
|
||||
*
|
||||
* <p> The {@code ServerSocket} class defines convenience
|
||||
* methods to set and get several socket options. This class also
|
||||
@ -76,7 +73,6 @@ import sun.net.PlatformSocketImpl;
|
||||
* Additional (implementation specific) options may also be supported.
|
||||
*
|
||||
* @see java.net.SocketImpl
|
||||
* @see java.net.ServerSocket#setSocketFactory(java.net.SocketImplFactory)
|
||||
* @see java.nio.channels.ServerSocketChannel
|
||||
* @since 1.0
|
||||
*/
|
||||
@ -164,8 +160,6 @@ public class ServerSocket implements java.io.Closeable {
|
||||
* 0 and 65535, inclusive.
|
||||
*
|
||||
* @see java.net.SocketImpl
|
||||
* @see java.net.SocketImplFactory#createSocketImpl()
|
||||
* @see java.net.ServerSocket#setSocketFactory(java.net.SocketImplFactory)
|
||||
* @see SecurityManager#checkListen
|
||||
*/
|
||||
public ServerSocket(int port) throws IOException {
|
||||
@ -217,8 +211,6 @@ public class ServerSocket implements java.io.Closeable {
|
||||
* 0 and 65535, inclusive.
|
||||
*
|
||||
* @see java.net.SocketImpl
|
||||
* @see java.net.SocketImplFactory#createSocketImpl()
|
||||
* @see java.net.ServerSocket#setSocketFactory(java.net.SocketImplFactory)
|
||||
* @see SecurityManager#checkListen
|
||||
*/
|
||||
public ServerSocket(int port, int backlog) throws IOException {
|
||||
@ -929,7 +921,17 @@ public class ServerSocket implements java.io.Closeable {
|
||||
* {@code checkSetFactory} method doesn't allow the operation.
|
||||
* @see java.net.SocketImplFactory#createSocketImpl()
|
||||
* @see SecurityManager#checkSetFactory
|
||||
* @deprecated Use a {@link javax.net.ServerSocketFactory} and subclass {@code ServerSocket}
|
||||
* directly.
|
||||
* <br> This method provided a way in early JDK releases to replace the
|
||||
* system wide implementation of {@code ServerSocket}. It has been mostly
|
||||
* obsolete since Java 1.4. If required, a {@code ServerSocket} can be
|
||||
* created to use a custom implementation by extending {@code ServerSocket}
|
||||
* and using the {@linkplain #ServerSocket(SocketImpl) protected
|
||||
* constructor} that takes an {@linkplain SocketImpl implementation}
|
||||
* as a parameter.
|
||||
*/
|
||||
@Deprecated(since = "17")
|
||||
public static synchronized void setSocketFactory(SocketImplFactory fac) throws IOException {
|
||||
if (factory != null) {
|
||||
throw new SocketException("factory already defined");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2021, 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
|
||||
@ -33,8 +33,6 @@ import java.io.IOException;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
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;
|
||||
@ -45,10 +43,7 @@ import java.util.Collections;
|
||||
* between two machines.
|
||||
* <p>
|
||||
* The actual work of the socket is performed by an instance of the
|
||||
* {@code SocketImpl} class. An application, by changing
|
||||
* the socket factory that creates the socket implementation,
|
||||
* can configure itself to create sockets appropriate to the local
|
||||
* firewall.
|
||||
* {@code SocketImpl} class.
|
||||
*
|
||||
* <p> The {@code Socket} class defines convenience
|
||||
* methods to set and get several socket options. This class also
|
||||
@ -96,7 +91,6 @@ import java.util.Collections;
|
||||
* </blockquote>
|
||||
* Additional (implementation specific) options may also be supported.
|
||||
*
|
||||
* @see java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory)
|
||||
* @see java.net.SocketImpl
|
||||
* @see java.nio.channels.SocketChannel
|
||||
* @since 1.0
|
||||
@ -282,9 +276,7 @@ public class Socket implements java.io.Closeable {
|
||||
* @throws IllegalArgumentException if the port parameter is outside
|
||||
* the specified range of valid port values, which is between
|
||||
* 0 and 65535, inclusive.
|
||||
* @see java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory)
|
||||
* @see java.net.SocketImpl
|
||||
* @see java.net.SocketImplFactory#createSocketImpl()
|
||||
* @see SecurityManager#checkConnect
|
||||
*/
|
||||
public Socket(String host, int port)
|
||||
@ -318,9 +310,7 @@ public class Socket implements java.io.Closeable {
|
||||
* the specified range of valid port values, which is between
|
||||
* 0 and 65535, inclusive.
|
||||
* @throws NullPointerException if {@code address} is null.
|
||||
* @see java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory)
|
||||
* @see java.net.SocketImpl
|
||||
* @see java.net.SocketImplFactory#createSocketImpl()
|
||||
* @see SecurityManager#checkConnect
|
||||
*/
|
||||
public Socket(InetAddress address, int port) throws IOException {
|
||||
@ -448,9 +438,7 @@ public class Socket implements java.io.Closeable {
|
||||
* @throws IllegalArgumentException if the port parameter is outside
|
||||
* the specified range of valid port values, which is between
|
||||
* 0 and 65535, inclusive.
|
||||
* @see java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory)
|
||||
* @see java.net.SocketImpl
|
||||
* @see java.net.SocketImplFactory#createSocketImpl()
|
||||
* @see SecurityManager#checkConnect
|
||||
* @deprecated Use DatagramSocket instead for UDP transport.
|
||||
*/
|
||||
@ -492,9 +480,7 @@ public class Socket implements java.io.Closeable {
|
||||
* the specified range of valid port values, which is between
|
||||
* 0 and 65535, inclusive.
|
||||
* @throws NullPointerException if {@code host} is null.
|
||||
* @see java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory)
|
||||
* @see java.net.SocketImpl
|
||||
* @see java.net.SocketImplFactory#createSocketImpl()
|
||||
* @see SecurityManager#checkConnect
|
||||
* @deprecated Use DatagramSocket instead for UDP transport.
|
||||
*/
|
||||
@ -1761,7 +1747,17 @@ public class Socket implements java.io.Closeable {
|
||||
* {@code checkSetFactory} method doesn't allow the operation.
|
||||
* @see java.net.SocketImplFactory#createSocketImpl()
|
||||
* @see SecurityManager#checkSetFactory
|
||||
* @deprecated Use a {@link javax.net.SocketFactory} and subclass {@code Socket}
|
||||
* directly.
|
||||
* <br> This method provided a way in early JDK releases to replace the
|
||||
* system wide implementation of {@code Socket}. It has been mostly
|
||||
* obsolete since Java 1.4. If required, a {@code Socket} can be
|
||||
* created to use a custom implementation by extending {@code Socket}
|
||||
* and using the {@linkplain #Socket(SocketImpl) protected
|
||||
* constructor} that takes an {@linkplain SocketImpl implementation}
|
||||
* as a parameter.
|
||||
*/
|
||||
@Deprecated(since = "17")
|
||||
public static synchronized void setSocketImplFactory(SocketImplFactory fac)
|
||||
throws IOException
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user