RFR: 8235139: Remove the socket impl factory mechanism
Daniel Fuchs
dfuchs at openjdk.java.net
Wed Feb 3 11:38:42 UTC 2021
On Wed, 3 Feb 2021 11:03:51 GMT, Patrick Concannon <pconcannon at openjdk.org> wrote:
> Hi,
>
> Could someone please review my proposed changeset for JDK-8235139: '`Remove the socket impl factory mechanism`' ?
>
> These changes propose to deprecate (for the eventual removal) the API points for statically configuring a system-wide factory for the `Socket`, `ServerSocket`, and `DatagramSocket` types in the `java.net package`. Specifically, the following:
>
> **Methods**:
> - `static void Socket.setSocketImplFactory(SocketImplFactory fac)`
> - `static void ServerSocket.setSocketFactory(SocketImplFactory fac)`
> - `static void DatagramSocket.setDatagramSocketImplFactory(DatagramSocketImplFactory fac)`
>
> **Types**:
> - `java.net SocketImplFactory`
> - `java.net DatagramSocketImplFactory`
>
> The CSR for[ JDK-8220494](https://bugs.openjdk.java.net/browse/JDK-8220494) contains some verbiage about the potential
> issues that setting factories can have, and alludes to their possible
> future removal.
>
> Kind regards,
> Patrick
Changes requested by dfuchs (Reviewer).
src/java.base/share/classes/java/net/Socket.java line 546:
> 544: @SuppressWarnings("deprecation")
> 545: void setImpl() {
> 546: SocketImplFactory factory = Socket.factory;
The scope of `@SuppressWarnings` should be reduced as much as possible. I believe in this case it can be reduced to the assignation of the factory:
@SuppressWarnings("deprecation")
SocketImplFactory factory = Socket.factory;
-------------
PR: https://git.openjdk.java.net/jdk/pull/2375
More information about the net-dev
mailing list