ByteBuffer recycling class

Posted by Chris Dennett on Stack Overflow See other posts from Stack Overflow or by Chris Dennett
Published on 2010-02-26T01:52:38Z Indexed on 2010/05/23 3:10 UTC
Read the original article Hit count: 472

Hi everyone, I'm wonder how I'd code up a ByteBuffer recycling class that can get me a ByteBuffer which is at least as big as the specified length, and which can lock up ByteBuffer objects in use to prevent their use while they are being used by my code. This would prevent re-construction of DirectByteBuffers and such over and over, instead using existing ones. Is there an existing Java library which can do this very effectively? I know Javolution can work with object recycling, but does that extend to the ByteBuffer class in this context with the requirements set out?

Cheers,
Chris

© Stack Overflow or respective owner

Related posts about java

Related posts about data-structures