[undertow-dev] WebSockets static sendBinary methods.and PooledByteBuffers

Stuart Douglas sdouglas at redhat.com
Thu Jan 26 18:36:45 EST 2017


On Fri, Jan 27, 2017 at 6:50 AM, Mario Carbajal
<mario.e.carbajal at gmail.com> wrote:
> From looking at the source it seems that the WebSockets.sendBinary methods
> that take ByteBuffer will take ownership of the buffer, meaning I shouldn't
> modify (or return it to a pool) after I pass it to these methods. Is this
> correct?

Yes, you need to wait for the callback to be called before you can do
anything with it.

>
> Looking at sendInternal, the buffer passed is then wrapped in a dummy
> ImmediatePooledByteBuffer. I could make alternative versions of these
> sendBinary methods that take PooledByteBuffer. Allowing me to use pooled
> buffers.

Sounds good.

>
> Since this functionality is missing it makes me think that there may be a
> reason why it shouldn't be done.

Mostly because nobody has asked for it yet.

Stuart

>
> _______________________________________________
> undertow-dev mailing list
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev


More information about the undertow-dev mailing list