directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trustin Lee <>
Subject Re: [mina] Refactoring MINA IoFilterChain (Was: IoFilters: DIRMINA-121 / 122)
Date Tue, 15 Nov 2005 09:20:10 GMT
Hi Dave,

2005/11/15, Irving, Dave <>:
> To me, the current filter chain / filter implementation looks quite
> complicated. I haven't got familiar enough with the code yet to know
> whether ths complexity is an unfortunate necessity.

Yes, it is really complex. :)

Just so we know what my proposed approach is, I'll try and describe the
> basics here:
> 1) I don't see how refactoring the chains affects Jose's approach. If we
> have individual chains, we can still pass them to a builder to be
> populated

Right there's no much relationship.

2) Why not make IoFilterChain move towards the composite pattern? A
> filter chain is just a special type of filter which filters in a
> sequence. No special head, no special tail. Just a sequence 0..n. So
> given some "BasicFilterChain" impl, we can add both individual filters
> and filter chains to the chain. NextFilters can ** still ** be cached by
> individual filters - no change there.
> 3) I think filters can still be used ** without ** cloning and without
> special "setIoProcessor" methods. Asume that we have (2). When a new
> connection is established, all we have to do is "hook up" our sub
> chains:
> BasicFilterChain connectionChain = new BasicFilterChain();
> connectionChain.addLast(sessionManagerChain);
> connectionChain.addLast(portChain);
> BasicFilterChain sessionChain = new BasicFilterChain();
> someChainBuilder.buildChain(sessionChain); // Jose's approach
> connectionChain.addLast(sessionChain);
> connectionChain.add(endOfTheLineFilter);

Explicitly asking users to add head/tail filter is a bad idea. But I think
it is a great idea. But we don't need to make a chain be nested more than
one level. And head and tail filter must be hidden from user to prevent from
unexpected removal or reordering.

what we call human nature is actually human habit

View raw message