Sunday, 25 August 2013

Rely on socket setReceiveBufferSize or use a BlockingQueue?

Rely on socket setReceiveBufferSize or use a BlockingQueue?

I am doing an application that will imply reading a lot of data sent to my
socket.
The problem I have is whether if should I rely on the socket
setReceiveBufferSize, put a big value there to hope that it will gather
all the data that I have until I am able to process it, or use a
BlockingQueue to put everything there and then process it from another
thread that keeps pooling and processing data?
Also is it a bad design if I let the queue with the max number of
elements? ( so I'm just telling it, "yeah receive as many element as you'd
like"), I'm referring to the memory consumption if I will receive a really
big number of elements?
Regards, Aurelian

No comments:

Post a Comment