H'm, the situation become more interesting.
Correct me if I am wrong.
I need to write empty message in order to increase writtenMessages counter.
ProtocolCodecFilter sends empty message after encoderOutput flashed, so
counter will be increased, but what will heppen if I don't use
ProtocolCodecFilter? I need to know what I need to send empty message? It is
very strange.
And imagine next situation:
ProtocolCodecFilter used with my encoder which added requests to
encoderOuput. Requests can contain empty buffers, why not. And when
encoderOut flushed, then writtenMessages counter will be equal to number of
empty buffers plus one from last empty message from ProtocolCodecFilter.
In trivial case when I send one empty message, then no one byte will be send
by transport channel, but writtenMessages counter will be equal to 2. :)
And also next issue:
Decoding process in messageReceived is synchonized, but encoding does not.
That's why in case of multithreaded system messages from different threads
can be mixed before they will be added to writeRequestQueue for
transportation
Am I Correct?
Sergey
Sergey Mamitko wrote:
Hello,
Can you explain an idea why ProtocolCodecFilter writes messages twice to
next filter.
One time with HiddenByteBuffer: data sent to transport channel, but
notification about send not passed to handler And second time with
MessageByteBuffer: wrapped data byffer going trough filters but not sent
to transport channel and notification about send then passed to handler
From the top of my head, it's a trick used to generate an event when the
complete message has been sent. An empty buffer is written, and that
increment the Message Written counter.
If I'm not wrong about the explanation, this is definitively something
which has to be fixed (I already questionned myself about this behaviour,
but never had time to fix it).
A JIRA would be welcomed !
-------------------------
Sergey Mamitko [EMAIL PROTECTED]
ISD, http://www.isd.dp.ua/index.html.en
--
--
cordialement, regards,
Emmanuel Le'charny
www.iktek.com
directory.apache.org