8146298: (dc spec) connect and disconnect methods should specify that they may block

Brian Burkhalter brian.burkhalter at oracle.com
Fri Nov 1 15:53:17 UTC 2019


> On Nov 1, 2019, at 5:39 AM, Chris Hegarty <chris.hegarty at oracle.com> wrote:
> 
>> CSR filed: https://bugs.openjdk.java.net/browse/JDK-8233342 <https://bugs.openjdk.java.net/browse/JDK-8233342>.
>> 
> 
> I think this is probably fine.
> 
> "Any datagrams received prior to connecting the socket are discarded.”
> 
> I assume that datagrams received by user code, prior to connecting, are in no way discarded, right?

Right. Inside connect() it simply loops on receive() until there is nothing left.

> I find the use of the naked term, “socket', in the implNote a little uncomfortable. Maybe “the channel’s socket” ?

I agree. I think it was all right as is when it was just the last sentence in the paragraph and not a standalone implNote.

> That said, there are inconsistencies all over the place between “channel”, “socket”, and “channel’s socket” (I don’t suggest that you try to tackle them in this issue).

I noticed that as well but did not want to deal with them here, either.

> Either that, or I don’t understand the subtle differences or the difference is not significant. For example, the connect method uses all three of these terms:

I took “socket”  to mean things constrained to the wrapped socket adapter versus things pertaining to the overall channel. That said it could probably use some rewording at some point.

Thanks,

Brian

>     /**
>      * Connects this channel's socket.
>      *
>      * <p> The channel's socket is configured so that it only receives ...
>      * ... A datagram socket remains connected until it is
>      * explicitly disconnected or until it is closed.
>      *
>      * ...  If another thread has already initiated a read or
>      * write operation upon this channel, ...
>      * ... If this channel's socket is not bound then ...
>      *
>      * @implNote
>      * Any datagrams received prior to connecting the socket are discarded.
>      *
>      * @param  remote
>      *         The remote address to which this channel is to be connected
>      *
>      * @return  This datagram channel
>      *
>      * @throws  AlreadyConnectedException
>      *          If this channel is already connected
>      *
>      * @throws  ClosedChannelException
>      *          If this channel is closed
>      * ...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20191101/f810df4d/attachment.html>


More information about the nio-dev mailing list