On 2/21/06, Niklas Therning <[EMAIL PROTECTED]> wrote:
>
> Chris Allen wrote:
> > Hey Guys,
> >
> > It looks like I'm running into a very similar problem with my
> application,
> > at least it's similar symptoms.  I think it must have to do with me
> storing
> > another ByteBuffer in the IoSession for access by all of my
> > ProtocolDecoders. It basically is there to handle the case were I get
> one
> > message sent in multiple packets and I want to wait to send the complete
> > message through to the IoHandler.  I just put the incomplete message
> into
> > this ByteBuffer and when the next packet comes in (in the decode()
> method) I
> > combine the "in" ByteBuffer with the one that is in my IoSession.  If
> this
> > new ByteBuffer is complete, I decode it and pass it on using out.write
> > (myCompleteMessage);
>
> FYI, there's already a ProtocolDecoder implementation included in MINA
> which does exactly what you are doing: CumulativeProtocolDecoder. Using
> that as a basis for your own ProtocolDecoder you won't have to care
> about maintaining the incomplete messages in a buffer tied to the
> session. MINA will take care of that for you.


Yeah, I knew about that one, and that is what I based my version on.

I suggest that you refactor your ProtocolDecoder to use
> CumulativeProtocolDecoder first to see if that fixes the problem. Maybe
> you're not releasing the buffers correctly?


I think the thing that I forgot to do is to clean up the buf instance with
the dispose() method.  Man I hope that's it. :-)  Thanks for reminding me of
your CumulativeProtocolDecoder though, as just reviewing the code made this
clear to me.

> Also, on another note, I wanted to download the source and take a look at
> > things but the SVN link listed on your site doesn't seem to work:
> >
> http://svn.apache.org/viewcvs.cgi/directory/network/trunk/?root=Apache-SVN
> > Any ideas?
>
> Sorry about that. We've had a reorganization of the svn repository since
> the last update of the web site. The correct URL is
> https://svn.apache.org/viewcvs.cgi/directory/trunks/mina/.


No problem, thanks for letting me know where I can find it.

-Chris


HTH
> /Niklas
>

Reply via email to