WebSocket

Chris Hegarty chris.hegarty at oracle.com
Tue Feb 20 20:56:31 UTC 2018


> On 20 Feb 2018, at 20:49, Simone Bordet <simone.bordet at gmail.com> wrote:
> 
> Hi,
> 
> On Tue, Feb 20, 2018 at 9:35 PM, Chris Hegarty <chris.hegarty at oracle.com> wrote:
>> Optimistically, if the whole message is read from the underlying
>> socket in one native read ( small messages ), then the whole
>> message will be in a single byte buffer, zero copy.
> 
> Good.
> 
>> If not, then to re-assemble the whole message into a single byte buffer
>> will require some copying ( there is no composite byte buffer).
> 
> I don't see why the message should be reassembled, given
> MessagePart.[FIRST|PART|LAST] ?
> It's not that the user can ask for the kind of MessagePart, e.g. ask
> only for WHOLE messages that the implementation must reassemble on her
> behalf, no ?
> So it will *always* be the case that zero copy is possible, right ?

Correct.  I though that the conversation was related to the
Java EE API where the API supports requesting WHOLE
messages, which cannot be guaranteed to be zero-copy.
The Java SE API does not support requesting WHOLE
messages so does not have this issue.

-Chris.


More information about the net-dev mailing list