You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Erix Yao <er...@gmail.com> on 2008/10/04 04:36:58 UTC
IoFilter.NextFilter usage
Why the NextFilter interface is defined?
What is its special purpose?
It has almost the same interface with IoFilter, why define them again ?
Or we can let NextFilter extends IoFilter.
Re: IoFilter.NextFilter usage
Posted by John Fallows <jo...@kaazing.com>.
Hi Erix,
IoFilter is used to process messages in the filter chain between the network
(IoAcceptor / IoConnector) and the IoHandler. The same IoFilter can be
added to more than one different filter chain, such as on different
sessions.
NextFilter represents the IoFilter's membership in the filter chain. So,
even though the IoFilter might be shared, there is still a different
NextFilter instance for each time the shared IoFilter was added to a filter
chain.
This design allows the IoFilter implementor to remain unaware of the exact
IoFilter that comes next in the chain. So, if IoFilters are added or
removed from the filter chain dynamically, the NextFilter instance passed
into the IoFilter remains unchanged and automatically propagates calls to
the right IoFilter, based on the state of the filter chain when the call is
made.
Hope this helps,
-john.
On Fri, Oct 3, 2008 at 7:36 PM, Erix Yao <er...@gmail.com> wrote:
> Why the NextFilter interface is defined?
> What is its special purpose?
> It has almost the same interface with IoFilter, why define them again ?
> Or we can let NextFilter extends IoFilter.
>
--
>|< Kaazing Corporation >|<
John Fallows | CTO | +1.650.943.2436
800 W. El Camino Real, Ste 180 | Mountain View, CA 94040, USA
Re: IoFilter.NextFilter usage
Posted by Emmanuel Lecharny <el...@gmail.com>.
Alex Karasulu wrote:
> On Sat, Oct 4, 2008 at 5:45 AM, Emmanuel Lecharny <el...@gmail.com>wrote:
>
>
>> Hi guys,
>>
>> today I found a mail on the users ML :
>>
>>
>> Erix Yao wrote:
>>
>>
>>> Why the NextFilter interface is defined?
>>> What is its special purpose?
>>> It has almost the same interface with IoFilter, why define them again ?
>>> Or we can let NextFilter extends IoFilter.
>>>
>>>
>>>
>> This is quite an interesting mail. A perfect demonstration on the
>> complexity of this part of MINA, which is, IMHO, overworked.
>>
>> There is no need of those extra structure, as we can provide the very same
>> behavior (ie, dynamic filter addition, message chaining, etc) whithout
>> having to deal with such useless interfaces.
>>
>> I suggest we think twice about how to simplify the chain we have in order
>> to make it easier to use for those who are new comers - and also for those
>> who are already using MINA, not talking about those who are developing MINA
>> -.
>>
>> thoughts ?
>>
>
>
> I do think it gets problematic especially when the chain is long and one is
> debugging. It can also be confusing as it is to this user.
Even with 2 filters only, it's a nightmare to debug.
> However it does
> perform well.
Who cares ? I mean, that's the least important point, if the design is
flawed. We can do it much clear _and_ fast. Strange enough, good design
is often fast, when the opposite is not exactly obvious :)
> Perhaps we can experiment with different ways to lessen the
> complexity in a copy within the sandbox.
>
yeah, sure. This is something we can do before 2.0 is out, as it's not
impacting our users too much.
Thanks !
--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org
Re: IoFilter.NextFilter usage
Posted by Alex Karasulu <ak...@apache.org>.
On Sat, Oct 4, 2008 at 5:45 AM, Emmanuel Lecharny <el...@gmail.com>wrote:
> Hi guys,
>
> today I found a mail on the users ML :
>
>
> Erix Yao wrote:
>
>> Why the NextFilter interface is defined?
>> What is its special purpose?
>> It has almost the same interface with IoFilter, why define them again ?
>> Or we can let NextFilter extends IoFilter.
>>
>>
> This is quite an interesting mail. A perfect demonstration on the
> complexity of this part of MINA, which is, IMHO, overworked.
>
> There is no need of those extra structure, as we can provide the very same
> behavior (ie, dynamic filter addition, message chaining, etc) whithout
> having to deal with such useless interfaces.
>
> I suggest we think twice about how to simplify the chain we have in order
> to make it easier to use for those who are new comers - and also for those
> who are already using MINA, not talking about those who are developing MINA
> -.
>
> thoughts ?
I do think it gets problematic especially when the chain is long and one is
debugging. It can also be confusing as it is to this user. However it does
perform well. Perhaps we can experiment with different ways to lessen the
complexity in a copy within the sandbox.
Alex
Re: IoFilter.NextFilter usage
Posted by Emmanuel Lecharny <el...@gmail.com>.
Hi guys,
today I found a mail on the users ML :
Erix Yao wrote:
> Why the NextFilter interface is defined?
> What is its special purpose?
> It has almost the same interface with IoFilter, why define them again ?
> Or we can let NextFilter extends IoFilter.
>
This is quite an interesting mail. A perfect demonstration on the
complexity of this part of MINA, which is, IMHO, overworked.
There is no need of those extra structure, as we can provide the very
same behavior (ie, dynamic filter addition, message chaining, etc)
whithout having to deal with such useless interfaces.
I suggest we think twice about how to simplify the chain we have in
order to make it easier to use for those who are new comers - and also
for those who are already using MINA, not talking about those who are
developing MINA -.
thoughts ?
--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org
Re: IoFilter.NextFilter usage
Posted by Edwin Lee <ed...@yahoo.com.sg>.
Hi Erix,
When you implement an IoFilter, in some of the methods, you get a hook to the
next filter in the chain so that you can forward to the next filter (e.g.
messageReceived).
However, if, say, the messageReceived method in the IoFilter interface takes in
an instance of IoFilter instead of IoFilter.NextFilter, you would be able to do
a whole lot of stuffs to the IoFilter than would be possible with
IoFilter.NextFilter.
In this case, the IoFilter.NextFilter interface sort of acts as an interface
contract to what can be done with a hook to the next filter.
i'm still getting to grips with MINA though, so could anyone correct me if i'm
wrong.
HTH,
Edwin
--- Erix Yao <er...@gmail.com> wrote:
> Why the NextFilter interface is defined?
> What is its special purpose?
> It has almost the same interface with IoFilter, why define them again ?
> Or we can let NextFilter extends IoFilter.
______________________________________________________________________
Search, browse and book your hotels and flights through Yahoo! Travel.
http://sg.travel.yahoo.com