RFR: 8278326: Socket close is not thread safe and other cleanup

Jaikiran Pai jpai at openjdk.org
Tue Jan 10 14:42:55 UTC 2023


On Tue, 10 Jan 2023 14:06:41 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> src/java.base/share/classes/java/net/Socket.java line 633:
>> 
>>> 631:             SocketImpl previous = impl;
>>> 632:             impl = si;
>>> 633:             state = (SOCKET_CREATED | BOUND | CONNECTED);
>> 
>> Could we replace this line with `setConnected()` (which does the same thing as what's being done here)? The reason I say that is because it becomes a bit easier, in a IDE,  to see who all calls `setConnected()` and that helps understand which all places in the code trigger this state change. Given the context of this code, I suspect it wouldn't be any noticable impact on performance.
>> This is mostly a nit and you can ignore it if you prefer to keep it in the current form.
>
> In setConnectedImpl it needs to be very clear which state bits are set so I think I'd prefer to leave that as is.

That's fine with me.

-------------

PR: https://git.openjdk.org/jdk/pull/11863


More information about the net-dev mailing list