You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Vishal_Jain <pi...@gmail.com> on 2007/11/01 09:51:21 UTC

howto make CumulativeProtocolDecoder re-entrant

Hi All,

I noticed that when i have data coming into the decoder as chunks at a fast
rate i.e. before the processing for the first chunk has been completed, it
leads to undesirable results. Since, i don't get time to rewind the buffer
and thus the first buffer is lost. (exception from this is a byproduct;
ProtocolDecoderException: java.nio.BufferUnderflowException)

Earlier i was trying to ascertain if the message received is complete by
parsing for a special sequence (XML tag) by reading each byte in the buffer.
Later, i just converted the message received to a string and checked for the
sequence and accordingly returning true or false. Did manage to get around
the problem, however i don't suppose that this is the best way.

Would someone here have a better solution ?

Thanks in advance,
vishal
-- 
View this message in context: http://www.nabble.com/howto-make-CumulativeProtocolDecoder-re-entrant-tf4730028s16868.html#a13525068
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: howto make CumulativeProtocolDecoder re-entrant

Posted by Maarten Bosteels <mb...@gmail.com>.
Hello Vishal,

Please have a look at
http://mina.apache.org/tutorial-on-protocolcodecfilter.html

Maarten

On 11/1/07, Vishal_Jain <pi...@gmail.com> wrote:
>
>
> Hi All,
>
> I noticed that when i have data coming into the decoder as chunks at a
> fast
> rate i.e. before the processing for the first chunk has been completed, it
> leads to undesirable results. Since, i don't get time to rewind the buffer
> and thus the first buffer is lost. (exception from this is a byproduct;
> ProtocolDecoderException: java.nio.BufferUnderflowException)
>
> Earlier i was trying to ascertain if the message received is complete by
> parsing for a special sequence (XML tag) by reading each byte in the
> buffer.
> Later, i just converted the message received to a string and checked for
> the
> sequence and accordingly returning true or false. Did manage to get around
> the problem, however i don't suppose that this is the best way.
>
> Would someone here have a better solution ?
>
> Thanks in advance,
> vishal
> --
> View this message in context:
> http://www.nabble.com/howto-make-CumulativeProtocolDecoder-re-entrant-tf4730028s16868.html#a13525068
> Sent from the Apache MINA Support Forum mailing list archive at Nabble.com
> .
>
>