The alternative today is to create the entire chain on each session, which is even more expensive. This is why I have proposed some sort of lazy copying of the chain, which means that you only pay the price if you need to (if you actually modify your chain on a session). Per-acceptor (if we still keep it) and per-port can be added together during port binding (as this is a one time of operation).
The only issue left is that NextFilters are not safe anymore to remember for the entire lifecycle of the Filter. I see two possible solutions here:
1) Tell people it is not safe to remember and if you do it is at your own risk. You can always obtain the NextFilter from the session.
2) Add a IoFilter.chainRelocated(NextFilter old, NextFilter new) method to be called in the filter in the case of a copy. So any filter that caches will be notified of the change and do whatever is necessary.
I don't think both are bad. We'll have to find out the way users can cache the nextfilter instance.
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
