mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan D. Cabrera" <l...@toolazydogs.com>
Subject Re: [MINA 3.0] Initial thoughts on FilterChain
Date Fri, 27 Nov 2009 16:10:58 GMT

On Nov 26, 2009, at 2:25 AM, Ashish wrote:

> 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.

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();

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


View raw message