David Rosenstrauch wrote:
Ashish wrote:
On a similar note, on your code snippet
while (in.hasRemaining()) {
...
decoder.decode(session, in, decoderOut);
}
call decode only when the message is complete. For each iteration
calling this can be expensive. Something like isMessageComplete()
implementation, which tells you when the message can be decoded and
then call decode.
Wasn't my code snippet. That code is in ProtocolCodeFilter.
In the ProtocolCodecFilter, it makes sense to loop while there are bytes
to read. In other places, Ashish is right. But anyway, this code snippet
is not the one which cause your problem (and it's not your code, too).
At this point, when the codec kicks, the message is supposed to have
been completed. But the codec can't assume that a
cummulativeprotocolCodec is used to gather bytes until a full message
has been read - you can build a statefull decoder -.
Again, in your case, using a DummySession is not a good idea.
A question : are you trying to test your decoder or something else ?
DR
--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org