You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by GitBox <gi...@apache.org> on 2019/02/06 23:28:11 UTC

[GitHub] ivmaykov edited a comment on issue #810: ZOOKEEPER-3274: Use CompositeByteBuf to queue data in NettyServerCnxn

ivmaykov edited a comment on issue #810: ZOOKEEPER-3274: Use CompositeByteBuf to queue data in NettyServerCnxn
URL: https://github.com/apache/zookeeper/pull/810#issuecomment-461229422
 
 
   @normanmaurer I would like to reuse the same CompositeByteBuf instead of freeing it + allocating a new one next time data needs to be queued up. But, I would like to "empty out" the composite buf when it's fully read - basically remove all components from it and set readerIndex = writerIndex = capacity = 0. Then, next time data needs to be added I can just add the new component.
   
   I looked into the source, but wasn't exactly sure how to do this right. `clear()` just sets all indices to 0, but doesn't look like it removes any buffers. `discardReadComponents()` returns immediately when readerIndex == 0. What is the proper way to free all memory used by the components and make the CompositeByteBuf empty?
   
   Edit: it's probably in your "Netty in Action" book, but I left it at the office and am working from home today :/

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services