You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Sandro Pedrazzini <sa...@canoo.com> on 2008/05/14 08:46:05 UTC

long messages

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


Re: long messages

Posted by "이희승 (Trustin Lee)" <tr...@gmail.com>.
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  
<sa...@canoo.com> 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/