You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Ersin Er <er...@gmail.com> on 2006/01/25 19:21:22 UTC

[MINA] Filter Chain internals

Hi all and particularly MINA folks,

I have a question about MINA's IO Filter Chain implementation. If a
chain is composed of filters and every filter (or the message in the
filter) knows about a single nextFilter, how is MINA making the chain
work both directions? A nextFilter for a messageWritten method and
messageRead method should be different logically. Right? So I need
some explanation here.

Thanks.

--
Ersin

Re: [MINA] Filter Chain internals

Posted by Ersin Er <er...@gmail.com>.
On 1/25/06, Niklas Therning <ni...@trillian.se> wrote:
> Ersin Er wrote:
> > Hi all and particularly MINA folks,
> >
> > I have a question about MINA's IO Filter Chain implementation. If a
> > chain is composed of filters and every filter (or the message in the
> > filter) knows about a single nextFilter, how is MINA making the chain
> > work both directions? A nextFilter for a messageWritten method and
> > messageRead method should be different logically. Right? So I need
> > some explanation here.
> >
> > Thanks.
> >
> > --
> > Ersin
>
> Hi,
>
> I guess you mean messageReceived and filterWrite?

Ah sorry, I meant messageReceived and messageSent.

> The NextFilter actually encapsulates both the next and previous filters
> in the chain. When you call nextFilter.messageReceived()
> messageReceived() will be called on the next filter. While when you call
> nextFilter.filterWrite() filterWrite() will be called on the previous
> filter.

Ah Ok. Then nextFilter is interpreted differently for specific message
types. Cool approach.

Thanks for the answer and the excellent arch.

> /Niklas

--
Ersin

Re: [MINA] Filter Chain internals

Posted by Niklas Therning <ni...@trillian.se>.
Ersin Er wrote:
> Hi all and particularly MINA folks,
> 
> I have a question about MINA's IO Filter Chain implementation. If a
> chain is composed of filters and every filter (or the message in the
> filter) knows about a single nextFilter, how is MINA making the chain
> work both directions? A nextFilter for a messageWritten method and
> messageRead method should be different logically. Right? So I need
> some explanation here.
> 
> Thanks.
> 
> --
> Ersin

Hi,

I guess you mean messageReceived and filterWrite?

The NextFilter actually encapsulates both the next and previous filters
in the chain. When you call nextFilter.messageReceived()
messageReceived() will be called on the next filter. While when you call
nextFilter.filterWrite() filterWrite() will be called on the previous
filter.

/Niklas