mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashish <paliwalash...@gmail.com>
Subject Re: [MINA 3.0] Initial thoughts on FilterChain
Date Sat, 28 Nov 2009 03:59:41 GMT
>
>> Have started looking into the FilterChain implementation and here are
>> some initial thoughts
>>
>> 1. Rename IoFilterChain as IoChannel - it gives a more clear picture
>> and is easy to understand like imagine as a Channel with multiple
>> stages aka IoFilters.
>> This came while I was drawing on paper to design something.
>>
>> 2. Have captured a couple of API's that are core to IoChannel
>>
>>             IoSession getSession();
>>
>>             IoFilter getHead();
>>
>>             IoFilter getNextFilter(IoFilter currentFilter);
>>
>>             List<IoFilter> getAll();
>>
>>             void addFilter(String name, IoFilter filter);
>>
>>             void addAfter(String baseName, String filterName,
>> IoFilter filter);
>>
>>             void removeFilter(String filterName);
>
> My Mina is a bit rusty so my comments may be a bit off base.  I would
> simplify this to
>
> List<IoFilter> getChain()
>
> Where one can re/move items in the chain.
>
> I would remove the filter name parameter since this is an aspect of the
> filter and not its role in the chain.

This thought did crossed my mind :-)

> What we end up with is nice and clean and we leverage the well known class
> List and its iterators.  As a matter of fact, I might toss out the chain
> class all together and just have
>
> interface IoSession {
>    List<IoFilter> getChain();
> }
>

Hmm.. but we create a chain for an Acceptor or Connector, so very much
doubt that chain class will be gone altogether. Once the app goes in
action, we can modify it at runtime, as it gets associated with a
Session

> Here we just got rid of one class and six methods for the same exact
> functionality while leveraging well known classes, i.e. LIst<>.

-- 
thanks
ashish

Mime
View raw message