It is somewhat difficult to say which is a better approach because it's case-by-base.

In general, you need to write an efficient decoder and I/O handler which don't consume a lot of memory. For example, you could make your decoder not to buffer all the content of the long message but to flush it chunk by chunk (e.g. 32kb each). I/O handler could be implemented to consume each chunk properly as soon as possible. Otherwise, you could write the long message down to the disk if it is going to be stored somewhere.

On Wed, 14 May 2008 15:46:05 +0900, Sandro Pedrazzini <[EMAIL PROTECTED]> wrote:

Hi,

What is the best way to use handlers server side, when the messages are long, i.e. when they are divided into more buffers (different calls of IoHandlerAdapter.messageReceived())? I am using the StreamIoHandler, which helps to sum up the different buffers into a Stream wrapper. I wonder if this is the only (best) solution.

Any hint is appreciated.

Best regards
Sandro




--
Trustin Lee - Principal Software Engineer, JBoss, Red Hat
--
what we call human nature is actually human habit
--
http://gleamynode.net/

Reply via email to