mina-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frederic Soulier <fred.soulier...@googlemail.com>
Subject Re: Empty WriteRequest in overriden MessageSent method
Date Tue, 26 Jan 2010 13:50:26 GMT
2010/1/26 Ashish <paliwalashish@gmail.com>

> On Tue, Jan 26, 2010 at 4:41 PM, Frederic Soulier
> <fred.soulier.ml@googlemail.com> wrote:
> > Hi
> >
> > Using 2.0 RC1 I've got the following filter chain configured for a
> > NioSocketAcceptor:
> >
> > acceptor.getFilterChain().addLast("blacklist", new BlacklistFilter());
> > acceptor.getFilterChain().addLast("connection", new ConnectionFilter());
> > acceptor.getFilterChain().addLast("proto", new ProtocolCodecFilter(new
> > MyProtocolEncoder(), new MyProtocolDecoder()));
> > acceptor.getFilterChain().addLast("pool", new ExecutorFilter(new
> > OrderedThreadPoolExecutor()));
> > acceptor.setHandler(new MyHandler());
> >
> > I see some strange output when sending data (write) back to the clients.
> >
> > In my ConnectionFilter I've overriden the MessageSent method with:
> >
> > @Override
> > public void messageSent(NextFilter nextFilter, IoSession ios,
> WriteRequest
> > writeRequest)
> > throws Exception
> > {
> > log.trace("Sent(wire)     [{}b] [{}].",
> >        ((IoBuffer)writeRequest.getMessage()).remaining(),
> > ((IoBuffer)writeRequest.getMessage()).getHexDump());
> > }
>
> One thing that is missing is call to nextFilter.messageSent()
>
> > In my logs I can see what is sent down the wire
> > 11:00:20,157 Sent(wire)     [52b] [00 00 00 30 9A 47 A7 CE 33 C6 AC 72 CE
> 08
> > 79 A8 70 0C 1D 41 87 B1 2F D2 53 42 B7 85 B7 91 59 30 02 44 A0 42 00 50
> 28
> > 8D D3 4B 04 74 58 70 58 26 9E 46 35 C1].
> >
> > but somehow I immediately get an empty WriteRequest...
> >
> > 11:00:20,157 Sent(wire)     [0b] [empty].
>
> Hmm.. not sure abt this. Are both these traces from same snippet that
> you posted above?
>
> > Why is that?
> >
>
>

Yep the logging is from the same messageSent() and my cut&paste was wrong...

@Override
public void messageSent(NextFilter nextFilter, IoSession ios, WriteRequest
writeRequest)
throws Exception
{
log.trace("Sent(wire)     [{}b] [{}].",
((IoBuffer)writeRequest.getMessage()).remaining(),
((IoBuffer)writeRequest.getMessage()).getHexDump());
super.messageSent(nextFilter, ios, writeRequest);
}

I've only started dabbling with MINA 2.0 RC1 recently.  I can't remember
seing this with MINA 1.1.7

Fred

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message