The ordering of the filters (first, last) refers to the order in which
they "see" incoming data (i.e. data read from a socket). When data is
coming in (from the network) the first filter is the first to "see" the
data. The last filter "sees" this data right before it is delivered to
your IoHandler. When you write data to an IoSession the ordering is
reversed; the last filter in the chain is the first one to "see" the data.

I hope that explanation made any sense to you! :-)

/Niklas


Steven E. Harris wrote:
> I can't keep the first/last or head/tail sense straight for IoFilter
> processing. Does the first/last labeling refer to the sending/outbound
> perspective, with the first filter being the first to filter a write
> and the last to filter a read, or is the first filter the last to
> filter a write and the first to filter a read?
>
> I ask because I'm not sure whether to put my ExecutorFilter at the
> beginning or end of my filter chain. Right now I'm using this
> arrangement (with some names changed):
>
> ,----
> | // TODO: Figure out the ordering here:
> | //       Should the thread pool be first or last?
> | connector.getFilterChain().addLast( "my-codec",
> |                                      new ProtocolCodecFilter(
> |                                            new MyCodecFactory()) );
> | connector.getFilterChain().addLast( "thread-pool",
> |                                     new ExecutorFilter( executor ) );
> | connector.setHandler( new MyProtocolHandler() );
> `----
>
> That makes the ExecutorFilter the "last" filter. But what does that
> mean? Please advise.
>
>   

Reply via email to