이희승 (Trustin Lee) wrote:
Would be better to returns what has already been read. Sometime, you are just proxying the data, and you want to send it to the next consumer as soon as you get some. Otherwise, the queue will buffer potentially gigantic data in memory. (This is something we experimented with JpegPhoto data in Ldap, this is the reason I mention it).

We already have ByteBufferQueue.poll() if it's just for consuming as soon as possible? Are you suggesting something else?
Sorry, I thought that poll() just return a byte (E -> byte) but suddenly, I realise that it returns a ByteBuffer ! This is perfect.

Coming back the the base idea, with you BBQueue, you can add a new filter to stream the big data to disk if needed, so that you won't kill a server if memory is limited. Incming data will be proxied to the stream filter, and a decoder using this stream will be able to work without knowing that the data is in memory or on disk. That's all good.



--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to