|
Trustin, At the end you will have the last word,
but I really do not see how Niklas approach can be of any help when you do not
know the implementation of a protocol in some other package. Lets assume Niklas
preferred example which is SSL/no SSL enabled protocols. Now, I have a protocol implementation
provided by an IoHadler that as part of setting the protocol up, on every
sessionCreated() will put the following filters: 1) A multi-thread filter. 2) A codec filter 3) Some authentication filter Now Niklas wants to run this using SSL. He
creates a filter chain containing the SSL filter and passes it as the initial
chain. The result is that SSL will be executed
not in a multi-threaded fashion, because it will be before the multi-threading
filter. Alternatively, he may pass a chain with
both multi-thread and SSL, but then you finish with two multi-thread filters
which seems kind of wasteful. What you really want is to set up SSL after the
multi-thread filter, but that you cannot do by specifying an initial filter
chain. So how are people to use this facility in
the generic case, if you do not know what the protocol component is actually
doing? This is just a simple example, for many
protocols one could come up with several scenarios where you can have similar issues.
For example is I want to setup a different authentication filter and so on.
This is why I think you need to provide a way to manipulate the filter chain. Now, Niklas could achieve what he wants by
just extending the IoHandler: Handler = New XYZIoHandler() { public
void sessionCreated(Session s) { super(s); s.getFilterChain().addAfter(“threadFilter”,
new SSLFilter(…)); } } What’s wrong with all this? It does
not look too efficient that you need to set up the same filters on every
session creation. It seems to me much more efficient to configure them once
when binding to the port and reuse it for every session. Now to do that you
need some event call that allows for this global configuration to be set up at
binding time. Jose Alberto From:
Trustin Lee [mailto:[EMAIL PROTECTED] Hi Jose, 2005/11/11, Jose Alberto Fernandez <[EMAIL PROTECTED]>: Niklas provided a preconstructed
IoFilterChain, I am passing the code to construct the IoFilterChain. That is
the only difference. Should the person doing the binding know which filters are
needed for a protocol provided in some other package? Or should that be
expressed as part of the code in the package providing the protocol
implementation? Now I see the main difference between the two approaches. Let's
reanalyze the two:
|
- RE: [mina] Filter management (was Spring Integratio... Jose Alberto Fernandez
- Re: [mina] Filter management (was Spring Integ... Trustin Lee
- RE: [mina] Filter management (was Spring Integ... Jose Alberto Fernandez
