Johny Kadarisman wrote:
Thanks Steve, I finally found the solutions of my problem. I miss understood
the bytebuffer behaviour.
I try to mimic the http example, since the protocol i'm working is similar
to it. But the problem in my case, the session is not terminate on each
request. So, In certain cases, Mina call decodable methods with bytebuffer
contained previous request. In the example, It check the http methods using
absolute methods. Which lead me to the assumption that, buffer will always
contain a new bytes. Which is wrong. After I change all the buffer related
access to relative mode. Now, everything working good.
Yeah, this is quite a common error. The fact is that ByteBuffers are used as if they contain the data ready to be processed by the user's codec. This was somehow leading to mistakes, up to a point we started thinking about removing completely the ByteBuffer/IoBuffer class to replace it by an InputStream (sort of).

Buffers are generally speaking intended to store temporary data while they are copied from one layer to another. We used them with a modified semantic ad it was far from perfect. For instance, in order to offer extended functionalities like extended buffers ( ByteBuffers which size can be increased as we receive new bytes) we had to rewrite a complete proxy on top of the NIO byteBuffer. At the end of the day, it represented something like 20% of the code base.

2.0 should be much more easier to use.

Thanks !

--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to