users@websocket-spec.java.net

[jsr356-users] Re: RemoteEndpoint.send*(?) methods and ByteBuffer[]

From: Joakim Erdfelt <joakim_at_intalio.com>
Date: Fri, 8 Feb 2013 05:47:50 -0700

If I saw that API as an end user, I would assume passing in 4 ByteBuffers
would result in 4 binary messages, not 1 binary message of all the bytes
together.

--
Joakim Erdfelt <joakim_at_intalio.com>
webtide.com <http://www.webtide.com/>
Developer advice, services and support
from the Jetty & CometD experts
eclipse.org/jetty - cometd.org
On Fri, Feb 8, 2013 at 1:47 AM, Norman Maurer <nmaurer_at_redhat.com> wrote:
> Hi,
>
> I wonder if it would be possible to add another method for every
> RemoteEndPoint.send*(..) method that takes a ByteBuffer. The new method
> should look the same but take a ByteBuffer[] as argument .
>
> So for example add this method:
>
> void sendBytesByCompletion(ByteBuffer[] data, SendHandler completion);
>
>
> It would allow the user to reuse ByteBuffer and combine a few to one
> payload without the need to allocate a new one that can hold the whole
> payload, This also gives better support for Buffer pools with fixed size
> buffers.
> Implementations could then use gathering writes if they are based on NIO
> to write them out in an efficient manner. If not based on NIO it should be
> easy for them to just handle it by copy the contents.
>
> ---
> Norman Maurer
> nmaurer_at_redhat.com
>
> JBoss, by Red Hat
>
>
>
>