Hi All,
Our application is to put the message into a queue after getting it from
handler's messageReceived method.
But we found a fatal problem that the messageReceived method could pass the
same message object in sequencially.
For example, the first time messageReceived is fired, the message could be
the same object with the second time messageReceived is fired. In our
situation it's a problem since if we put the message into a queue, the first
message and the second message could be with the same value but actually
they shouldn't be the same.
I don't konw whether it is caused by our flush sevearl times in the decoder.
The following is the code in our decode:
protected boolean doDecode(IoSession arg0, IoBuffer in,
ProtocolDecoderOutput out) throws Exception {
int remain = in.remaining();
if ( remain >= length ) {
byte [] data = new byte [length];
while (remain >= length){
in.get(data,0,length);
out.write(data);
out.flush();
remain = in.remaining();
}
}
return false;
}
I used the loop is to improve the performance.
I think this is a very difficult problem.
Thank you my friends.
--
Best Regards
DAI Jun