ivmaykov commented 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?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to