RFR [13] 8225426: Replace plain with system-default in Socket and ServerSocket
Chris Hegarty
chris.hegarty at oracle.com
Fri Jun 7 11:24:47 UTC 2019
Another minor followup that we agreed to address after the integration
of 8221481 (Reimplement the Legacy Socket API).
Prior to 8221481, there was just a single default SocketImpl, the
"plain" socket impl. There are now two, PlainSocketImpl and
NioSocketImpl, the latter being the default. The former can be selected
as the default by setting the `jdk.net.usePlainSocketImpl` system
property, further information an be found in the Implementation Note of
`java.net.SocketImpl`.
The term "plain" is mentioned in a few places in the specification of
j.n.Socket and j.n.ServerSocket. These should be updated to
"system-default", which is the agreed term post 8221481.
src/java.base/share/classes/java/net/ServerSocket.java
/**
* Creates a server socket, bound to the specified port. A port number
* of {@code 0} means that the port number is automatically
* allocated, typically from an ephemeral port range. This port
* number can then be retrieved by calling {@link #getLocalPort getLocalPort}.
* <p>
* The maximum queue length for incoming connection indications (a
* request to connect) is set to {@code 50}. If a connection
* indication arrives when the queue is full, the connection is refused.
* <p>
* If the application has specified a server socket factory, that
* factory's {@code createSocketImpl} method is called to create
- * the actual socket implementation. Otherwise a "plain" socket is created.
+ * the actual socket implementation. Otherwise a system-default
+ * {@code SocketImpl} is created.
* <p>
* If there is a security manager,
* its {@code checkListen} method is called
* with the {@code port} argument
* as its argument to ensure the operation is allowed.
* This could result in a SecurityException.
*...
*/
public ServerSocket(int port) throws IOException
/**
* Creates a server socket and binds it to the specified local port
* number, with the specified backlog.
* A port number of {@code 0} means that the port number is
* automatically allocated, typically from an ephemeral port range.
* This port number can then be retrieved by calling
* {@link #getLocalPort getLocalPort}.
* <p>
* The maximum queue length for incoming connection indications (a
* request to connect) is set to the {@code backlog} parameter. If
* a connection indication arrives when the queue is full, the
* connection is refused.
* <p>
* If the application has specified a server socket factory, that
* factory's {@code createSocketImpl} method is called to create
- * the actual socket implementation. Otherwise a "plain" socket is created.
+ * the actual socket implementation. Otherwise a system-default
+ * {@code SocketImpl} is created.
* <p>
* ...
*/
public ServerSocket(int port, int backlog) throws IOException
src/java.base/share/classes/java/net/Socket.java
/**
* Creates a stream socket and connects it to the specified port
* number on the named host.
* <p>
* If the specified host is {@code null} it is the equivalent of
* specifying the address as
* {@link java.net.InetAddress#getByName InetAddress.getByName}{@code (null)}.
* In other words, it is equivalent to specifying an address of the
* loopback interface. </p>
* <p>
* If the application has specified a server socket factory, that
* factory's {@code createSocketImpl} method is called to create
- * the actual socket implementation. Otherwise a "plain" socket is created.
+ * the actual socket implementation. Otherwise a system-default
+ * {@code SocketImpl} is created.
* <p>
* If there is a security manager, its
* {@code checkConnect} method is called
* with the host address and {@code port}
* as its arguments. This could result in a SecurityException.
*
* ...
*/
public Socket(String host, int port) throws UnknownHostException, IOException
/**
* Creates a stream socket and connects it to the specified port
* number at the specified IP address.
* <p>
* If the application has specified a socket factory, that factory's
* {@code createSocketImpl} method is called to create the
- * actual socket implementation. Otherwise a "plain" socket is created.
+ * actual socket implementation. Otherwise a system-default
+ * {@code SocketImpl} is created.
* <p>
* If there is a security manager, its
* {@code checkConnect} method is called
* with the host address and {@code port}
* as its arguments. This could result in a SecurityException.
*
* ...
*/
public Socket(InetAddress address, int port) throws IOException
/**
* Creates a stream socket and connects it to the specified port
* number on the named host.
* <p>
* If the specified host is {@code null} it is the equivalent of
* specifying the address as
* {@link java.net.InetAddress#getByName InetAddress.getByName}{@code (null)}.
* In other words, it is equivalent to specifying an address of the
* loopback interface. </p>
* <p>
* If the stream argument is {@code true}, this creates a
* stream socket. If the stream argument is {@code false}, it
* creates a datagram socket.
* <p>
* If the application has specified a server socket factory, that
* factory's {@code createSocketImpl} method is called to create
- * the actual socket implementation. Otherwise a "plain" socket is created.
+ * the actual socket implementation.Otherwise a system-default
+ * {@code SocketImpl} is created.
* <p>
* If there is a security manager, its
* {@code checkConnect} method is called
* with the host address and {@code port}
* as its arguments. This could result in a SecurityException.
* <p>
* If a UDP socket is used, TCP/IP related socket options will not apply.
*
* ...
*/
@Deprecated
public Socket(String host, int port, boolean stream)
/**
* Creates a socket and connects it to the specified port number at
* the specified IP address.
* <p>
* If the stream argument is {@code true}, this creates a
* stream socket. If the stream argument is {@code false}, it
* creates a datagram socket.
* <p>
* If the application has specified a server socket factory, that
* factory's {@code createSocketImpl} method is called to create
- * the actual socket implementation. Otherwise a "plain" socket is created.
+ * the actual socket implementation. Otherwise a system-default
+ * {@code SocketImpl} is created.
*
* <p>If there is a security manager, its
* {@code checkConnect} method is called
* with {@code host.getHostAddress()} and {@code port}
* as its arguments. This could result in a SecurityException.
* <p>
* If UDP socket is used, TCP/IP related socket options will not apply.
*
* ...
*/
@Deprecated
public Socket(InetAddress host, int port, boolean stream)
-Chris.
More information about the net-dev
mailing list